2012-01-03 1 views
0

유형이 다른 엔터티 컬렉션이 있고 JSONSimple을 사용하여 JSON String으로 변환하려고합니다.Java에서 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); 

, 그것은 단지 컬렉션 toString() 대신 컬렉션의 요소 방법을 반환

답변

관련 문제