Added support for serializing to arbitrary (to/from) Maps by inspecting the generic types of the map.