标题翻译
Java Parse Json response string
问题
{
"count": 61,
"next": "https://swapi.co/api/planets/?page=2",
"previous": null,
"results": [
{
"name": "Alderaan",
"rotation_period": "24"
},
{
"name": "Yavin IV",
"rotation_period": "24"
}
]
}
String responseString = content.toString();
System.out.println(responseString);
JSONObject jsonObject = new JSONObject(responseString);
Error:
JSONObject请求映射错误
英文翻译
{
"count": 61,
"next": "https://swapi.co/api/planets/?page=2",
"previous": null,
"results": [
{
"name": "Alderaan",
"rotation_period": "24",
},
{
"name": "Yavin IV",
"rotation_period": "24",
},
]
}
How I can convert to Array? Whe JsonObject Requires Map?
String responseString=content.toString();
System.out.println(responseString);
JSONObject jsonObject = new JSONObject(responseString);
Error:
JSONObject request map
专注分享java语言的经验与见解,让所有开发者获益!
评论