すべての Json 配列が同じ名前を持つ Json ファイルを解析したい:
[
{
"mobileMachine":{
"condition":"GOOD",
"document":"a",
"idNr":"ce4f5a276a55023efced9c6a4b02bf4fcff04c06b4338467c8679770bff32313f7f372b5ec2f7527dad0de47d0fb117e"
}
},
{
"mobileMachine":{
"condition":"GOOD",
"document":"b",
"idNr":"ce4f5a276a8e023efced9c6a4b02bf4fcff04c06b4338467c8679770bff32313f7f372b5ec2f7527dad0de47d0fb217e"
}
},
...
]
だからここに私の小さなコードがあります:
JSONArray json = new JSONArray(urlwhereIGetTheJson);
for (int count = 0; count < json.length(); count++) {
JSONObject obj = json.getJSONObject(count);
String condition = obj.getString("condition");
String document = obj.getString("document");
String idNr = obj.getString("idNr");
db.addMachine(new MachineAdapter(condition, document, idNr));
}
JSON ファイルを正しく解析する方法を教えていただければ幸いです。ありがとうございました
JSON ファイルを編集できません。(ファイルには 300 以上のモバイルマシンが含まれています。私はこれを短縮しました)。
(私の英語でごめんなさい)