سؤال

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

هل كانت مفيدة؟

المحلول

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());
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top