0
How can I get the index name of a JSON object in Java in Android Studio.
Code:
JSONObject jsonObject = new JSONObject();
try {
jsonObject.put("nome", "");
jsonObject.put("sobrenome", "asdasd");
jsonObject.put("nomeCompleto", "Renato Vieira de Souza");
} catch (JSONException e) {
e.printStackTrace();
}
for(int i=0; i < jsonObject.length(); i++){
try {
if(VERIFICAR AQUI SE CADA INDICE DO ARRAY É MENOR QUE 1){
Recursos.toastLento(getApplicationContext(), "nome vazio");
}
} catch (JSONException e) {
e.printStackTrace();
}
}
My need is to detect any Dice that appear in json and check if it is empty, so I will create a method to validate a json and let you know which json or which ones are empty.