0
我有這種格式的數據。Java json提取數據
{"responseData": {"results":[{"GsearchResultClass":"GwebSearch",.......}],"cursor":{"resultCount":"16,900,000","pages":[........
我已經把全文放入第一。
JSONObject fullResult = new JSONObject(text);//text represents my data.
JSONObject responseData1 = fullResult.JSONObject("responseData");
這裏我不斷收到這個「錯誤:方法getJSONObject類的JSONObject不能應用於給定類型;」。
我需要僅提取resultCount的值。我一直在這裏被困住。
我可以直接訪問 「RESULTCOUNT個」: 「16,900,000」?我只需要1690萬的價值? – user2711681
@ user2711681不,它嵌套在另一個JSON對象中。您需要先獲取該JSON對象(以及其他任何其他內容)。 –
好吧,我知道了JSONObject fullResult = new JSONObject(text); \t \t JSONObject responseData1 = fullResult.getJSONObject(「responseData」); \t \t JSONObject cursor1 = responseData1.getJSONObject(「cursor」);我想這導致我直到遊標我是正確的? – user2711681