Question

I am having a correct JSON String which is made out of an Object A, containing a Set of other Objects B.

When I try to get back this Object now from the JSON String, the Set of Objects B will only have a single entry, instead of all the contained in the JSON String.

Any suggestions, or did I just do something forbidden??

Thanks

Was it helpful?

Solution

For those who might fall over it, this solved the problem with the Set:

JSONArray jsonArray = JSONArray.fromObject(object);
JSONObject jsonObject = new JSONObject();
jsonObject.put("data", jsonArray.toString());
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top