Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JSONException: No value for id

It reads and writes fine from the database but gives the JSONException error. Any help would be greatly appreciated!

Thank you

like image 893
user1466971 Avatar asked Jan 17 '23 03:01

user1466971


1 Answers

This error happens in getter functions of a JSONObject and it means that you are trying to retrieve a value from the JSONObject using an id that doesn't exist in the JSONObject. Before retrieving a value, check if it actually exists in the JSONObject by the has(String name) method or using the opt methods. For more information about the JSONObject class see here.

EDIT From your error log, the error triggers in a getString method inside the OnClickListener of your Button named btnRegister.

like image 108
Angelo Avatar answered Jan 18 '23 22:01

Angelo