0

I have a non-typed collection of Entities and want to convert to JSON String, using JSONSimple.

I've tried with JSONObject like:

Collection entities; //supose its a non-typed Collection returned from service.
JSONObject colJSON = new JSONObject();
colJSON.put("entities",entities);
JSONValue.toJSONString(colJSON);

But, it just returns the Collection toString() method instead of the elements of the Collection;

1 Answers1

0

Try a List instead of Collection. I don't see 'Collection' in JSONSimple's supported type list.

Roy Truelove
  • 22,016
  • 18
  • 111
  • 153