{
"id":1465271593,
"title":"SmartChairIoT",
"private":"true",
"feed":"https://api.xively.com/v2/feeds/1465271593.json",
"status":"frozen",
"updated":"2016-09-26T13:45:42.461310Z",
"created":"2015-08-11T03:51:06.988349Z",
"creator":"https://personal.xively.com/users/1302767g",
"version":"1.0.0",
"datastreams":
[{"id":"force1","current_value":"0",
"at":"2016-09-26T13:45:36.212846Z",
"max_value":"1023.0",
"min_value":"0.0"},
"product_id":"KsihJuMSx165179ihiIC",
"device_serial":"GNGZNY2TT44Y"
}
答案 0 :(得分:0)
你应该尝试使用像gson这样的库 https://guides.codepath.com/android/Leveraging-the-Gson-Library
答案 1 :(得分:0)
这是有效的JSON。您的代码中的数组未关闭。
{
"id": 1465271593,
"title": "SmartChairIoT",
"private": "true",
"feed": "https://api.xively.com/v2/feeds/1465271593.json",
"status": "frozen",
"updated": "2016-09-26T13:45:42.461310Z",
"created": "2015-08-11T03:51:06.988349Z",
"creator": "https://personal.xively.com/users/1302767g",
"version": "1.0.0",
"datastreams": [{
"id": "force1",
"current_value": "0",
"at": "2016-09-26T13:45:36.212846Z",
"max_value": "1023.0",
"min_value": "0.0"
}],
"product_id": "KsihJuMSx165179ihiIC",
"device_serial": "GNGZNY2TT44Y"
}
您可以通过
将其转换为JSON对象JSONObject jsonObj = new JSONObject("Your JSON Data");