如果您正在谈论在Java库中使用JSON,那么由于您的输入字符串是JSON对象,而不是JSON数组,因此您应该首先使用JSONObject加载它:
String response=getResponseFromServer();JSonObject jsonObject = new JSonObject(response);
之后,您可以使用toJSONArray()将给定的键字符串数组将JSONObject转换为JSONArray:
String[] names = JSONObject.getNames(jsonObject);JSonArray jsonArray = jsonObject.toJSonArray(new JSonArray(names));


![Java将此字符串转换为JSONArray [关闭] Java将此字符串转换为JSONArray [关闭]](http://www.mshxw.com/aiimages/31/380431.png)
