下面的代碼正在打印的散列值,而不是陣列如何散列映射值轉換爲字符串
JSONObject myjson1 = new JSONObject(expectedResult);
Iterator x = myjson1.keys();
JSONArray jsonArray = new JSONArray();
while (x.hasNext()){
String key = (String) x.next();
jsonArray.put(myjson1.get(key));
System.out.println(x);
}
輸出如下:
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
PS:轉換JSON來陣列(鍵:值)形式
請參閱https://stackoverflow.com/questions/29140402/how-do-i-print-my-java-object-without-getting-sometype2f92e0f4 –