[json-lib-user] JSONObject.fromObject BUG?
Brought to you by:
aalmiray
From: <liu...@gm...> - 2007-08-21 07:36:29
|
json-lib version: 2.0 jdk15 public static void main(String[] args) { List<Map<String, Object>> list = new ArrayList<Map<String, Object>>(); Map<String, Object> m = new HashMap<String, Object>(); m.put("name", "json-lib"); list.add(m); JSONObject json = JSONObject.fromObject(list); System.out.println(json.toString()); } Exception in thread "main" net.sf.json.JSONException: 'object' is an array. Use JSONArray instead at net.sf.json.JSONObject.fromObject(JSONObject.java:255) at Main2.main(Main2.java:18) |