hashmap構建json對象,輸出時出現語法錯誤
為何我的使用hashmap構建json對象時,在System.out.println(new JSONObject(json).toString());出現語法錯誤,提示The constructor JSONObject(Map<String,Object>) is undefined未定義。。。
為何我的使用hashmap構建json對象時,在System.out.println(new JSONObject(json).toString());出現語法錯誤,提示The constructor JSONObject(Map<String,Object>) is undefined未定義。。。
2017-11-27
舉報
2018-02-15
試試System.out.println(new JSONObject().fromObject(json).toString());
2017-11-28
JSONObject這個類的構造方法里沒有參數為Map的構造方法
System.out.println(json.toString());這樣應該就對了