0

I have an API POST request. but when the response came out it give 2 different response in different condition.

1st: {"status":1,"result":{"user_key":"user_key","username":"username","verification_code_required":true}}

2nd: {"status":1,"result":{"user_id":"user_id","username":"username","is_authenticator":"0","authenticator_secret":"secret"}}

Here the question. Now I want to handle different activity using IF ELSE statement. When i use

if(results.getBoolean("verification_code_required") ){
    }else if{results.getString("is_authenticator") == 0{ 
    }

It return me error : org.json.JSONException: No value for is_authenticator when i get 1st response.

Can anyone help me please?

Derrick
  • 3,669
  • 5
  • 35
  • 50
joey
  • 73
  • 2
  • 14

0 Answers0