I'm looking at datastream.hpp but it does not show how it creates a map or dictionary object as I would expect.
Also, does the 'fields' attribute in the .abi file affect what gets deserialised?
There are two different datastream.hpp
headers, one for nodeos and one for contracts. It's unclear which you're asking about, so I'm including answers for both.
Nodeos's datasteam.hpp
works with raw.hpp
to serialize maps here and deserialize maps here. Like iostreams, the code that reads or writes to a map expects the map is already constructed. datastream.hpp
and raw.hpp
don't use the ABI. abi_serializer
does use the ABI.
Contracts use eosiolib's datasteam.hpp
. It serializes maps here and deserializes maps here. Contracts don't use the ABI internally. The ABI describes the contract for other tools and libraries to consume.