I have a object which I want to serialize to JSON. This object is a map with list of a specific objects. This looks similar to it:
Map<String, List<Object>> map = new Map<String, List<Object>>();
I am using FlexJSON. I can work only with flexjson.JSONSerializer
. There are my tries:
JSONSerializer jsonSerializer = new JSONSerializer();
// jsonSerializer.include("map");
// jsonSerializer.include("map.myList.object");
jsonSerializer.transform(new MapTransformer(), "map");
jsonSerializer.exclude("*.class");
As you can see I am trying now with Transformer
classes but I haven't succeeded. The commented lines will work, as I suppose, if my List<Object>
has own name for example myList
. But it doesn't haven own name, because it is values
of my map.
How can I serialize such object to JSON with FlexJSON?