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 回答1: 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.