我有一个非类型化的实体集合,并希望使用 JSONSimple 转换为 JSON 字符串。
我尝试过使用 JSONObject,例如:
Collection entities; //supose its a non-typed Collection returned from service.
JSONObject colJSON = new JSONObject();
colJSON.put("entities",entities);
JSONValue.toJSONString(colJSON);
但是,它只返回 Collection toString() 方法而不是 Collection 的元素;