我从API返回的JSONObject
实例aJsonObjectInstance
就像这样(以人类可读的形式):
[
{
"key_11":"value_11",
"key_12":"value_12",
"key_13":"value_13"
},
{
"key_21":"value_21",
"key_22":"value_22",
"key_23":"value_23"
},
{
"key_31":"value_31",
"key_32":"value_32",
"key_33":"value_33"
}
]
看起来它是JSONArray
个实例,但该类真的是JSONObject
,我如何将其解析为JSONObject
数组?
答案 0 :(得分:0)
如果Gson库总是这样的话,请使用它。
Gson gson = new Gson();
Type type = new TypeToken<MyModel>(){}.getType();
MyModel model = gson.fromJson(jsonString, type);