如何在嵌套的JSON結(jié)果中解析動態(tài)JSON密鑰?我有以下格式的JSON結(jié)果,JSON Lint將其顯示為“有效響應(yīng)”。我的問題是:如何訪問“question_mark”的內(nèi)容,因為“141”,“8911”等都是動態(tài)值?我的示例代碼用于訪問“product”的值。//Consider I have the first <code>JSONObject</code> of the "search_result" array and //I access it's "product" value as below.String product = jsonObject.optString("product"); //where jsonObject is of type JSONObject.//<code>product<code> now contains "abc".JSON:{
"status": "OK",
"search_result": [
{
"product": "abc",
"id": "1132",
"question_mark": {
"141": {
"count": "141",
"more_description": "this is abc",
"seq": "2"
},
"8911": {
"count": "8911",
"more_desc": "this is cup",
"seq": "1"
}
},
"name": "some name",
"description": "This is some product"
},我的問題標題“動態(tài)密鑰”可能是錯誤的,但我不知道在這一點上什么是這個問題的更好的名稱。任何幫助將不勝感激!
請問如何在嵌套的JSON結(jié)果中解析動態(tài)JSON密鑰?
慕碼人8056858
2019-09-05 10:05:21