{"1": {
"StoreName": "イオン八千代緑が丘店",
"StoreTel": "047-480-3660",
"StoreAddress": "〒276-0049 千葉県八千代市緑ヶ丘2-1-3 2F",
"WorkingTimeInNormalDay": "7:30 AM - 9:00PM",
"WorkingTimeInWeekend": "9:00-22:00",
"HaveKidProduct": "N"
}}
je veux lire JSON:JSONArray avec caractère ":" dans Android
JSONObject json ,jChild;
JSONArray jsonNames, jsonValues;
JSONArray jChildNames,jChildValues;
json = new JSONObject(resultString);
jsonNames = json.names();
jsonValues = json.toJSONArray(jsonNames);
for (int i = 0; i < jsonNames.length(); i++) {
jChild = jsonValues.getJSONObject(i);
jChildNames = jChild.names();
jChildValues = jChild.toJSONArray(jChildNames);
Log.i(getCallingPackage(), "No : " + jsonNames.getString(i));
for (int j = 0; j < jChildNames.length(); j++){
Log.i(getCallingPackage(),jChildNames.getString(j) + " : " + jChildValues.getString(j).trim());
}
}
}
-il des problèmes ici est: Quand je parse ceci:
"WorkingTimeInNormalDay": « 7: 30 h - 21h00 », j'ai
jChildValues.getString (j) retour "7" et non "07h30-21h00"
je pense peut être ":" caractère est la cause racine
Comment puis-je résoudre ce problème?
Merci
===========
Modifié:
Ceci est mon erreur
tout fonctionne comme un champion
Non, ' « 07h30-21h00 »' ne devrait pas être à l'origine de problème comme enfermé dans des guillemets doubles – waqaslam
mais si je n'ai pas « WorkingTimeInNormalDay »: "7:30 AM - 21:00", "WorkingTimeInWeekend": "9: 00-22: 00", tout est correct –
Je pense que c'est un problème d'encodage. Imprimez votre chaîne JSON. – Fredrik