{ "0":"", "54049":"ОП.мз-61а", "100606":"КМ-41", "100609":"МТ-41", "100612":"ЕМ-41", "100684":"ХК-51", "100685":"ЕМ-51", "100687":"КМ-51", "100688":"МТ-51", "100718":"ХК-51/1", "100719":"ХК-51/2", "100748":"ТС-61", "100749":"ТС-61/1", "100750":"ТС-61/2", "100754":"ЕМ-61", "100758":"ІМ-61/1МБ", "100759":"ІМ-61/2ГТ", "100760":"МБ-61", "100767":"ТС-51", "100770":"ТС-41", "100777":"ТС.м-61", "100778":"МТ.м-61", "100779":"ЕМ.м-61", "100780":"ТМ.м-61", "100781":"ТМ.м-62", "100782":"ГМ.м-61", "100783":"ВІ.м-61", "100786":"ХМ.м-61" }
0
A
Répondre
0
Vous devrez parcourir les clés JSONObject et comparer la valeur jusqu'à ce qu'une correspondance.
final String knownValue = "TC-41";
final Iterator<String> iterable = jsonObject.keys();
while (iterable.hasNext()) {
String key = iterable.next();
if (jsonObject.getString(key).equals(knownValue)) {
// key has the value you are looking for
return;
}
}
0
Utilisez les classes JSON pour l'analyse syntaxique
JSONObject mainObject = new JSONObject(Your_Sring_data);
String id = mainObject .getString("100770");
//here in this **id** string you can get value for **"TC-41"**
+0
De la même façon, vous pouvez obtenir toutes les valeurs dans les chaînes respectives –
double possible de [objet JavaScript obtenir la clé de valeur] (https://stackoverflow.com/questions/9907419/javascript-object-get-key-by-value) – eztam