【发布时间】:2020-12-05 13:19:17
【问题描述】:
我愿意从每个“显示”数组中获取数据的 JSON 示例
{
"score":17.873907,
"show":{
"id":139,
"url":"http://www.tvmaze.com/shows/139/girls",
"name":"Girls",
"type":"Scripted",
"language":"English",
"genres":[
"Drama",
"Romance"
],
"status":"Ended",
"runtime":30,
"premiered":"2012-04-15",
"officialSite":"http://www.hbo.com/girls",
"schedule":{
"time":"22:00",
"days":[
"Sunday"
]
},
"rating":{
"average":6.7
},
"weight":81,
"network":{
"id":8,
"name":"HBO",
"country":{
"name":"United States",
"code":"US",
"timezone":"America/New_York"
}
},
"webChannel":null,
"externals":{
"tvrage":30124,
"thetvdb":220411,
"imdb":"tt1723816"
},
"image":{
"medium":"http://static.tvmaze.com/uploads/images/medium_portrait/31/78286.jpg",
"original":"http://static.tvmaze.com/uploads/images/original_untouched/31/78286.jpg"
},
"summary":"<p>This Emmy winning series is a comic look at the assorted humiliations and rare triumphs of a group of girls in their 20s.</p>",
"updated":1600633829,
"_links":{
"self":{
"href":"http://api.tvmaze.com/shows/139"
},
"previousepisode":{
"href":"http://api.tvmaze.com/episodes/1079686"
}
}
}
}
我正在使用的请求代码很好地给了我响应,但我无法解析对 JSONObject 的响应
错误显示
org.json.JSONException:不能显示 java.lang.String 类型的值 转换为 JSONObject
【问题讨论】:
-
什么是新的 JSONObject("show")??
-
它应该类似于 new JSONObject(response)
-
JSONObject(response) 也显示异常类型无法转换为 JSON 对象。
-
您可以在将响应转换为 jsonobj 之前记录响应吗?确保你得到一个 json 字符串
-
请提供您的代码作为文本,而不是图片
标签: android json android-volley