2017-12-18 136 views

回答

0

你可以这样说:

创建一个JSONObject:

JSONObject jObject = new JSONObject(result); 

为了得到一个特定的布尔

String aJsonString = jObject.getBoolean("status"); 

为了得到一个特定的字符串

String aJsonString = jObject.getString("message"); 

为了得到一个特定的整数

int aJsonInteger = jObject.getInt("code"); 
1

可以使用Google's GSON库准确的章节目标建成的帮助​​。

YourPojoClass model = new Gson().fromJson(jsonResponse, YourPojoClass.class); 

使用jsonschema2pojo.org

将您的JSON来PojoModel