Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sample fails with JSONException: No value for modules #2

Open
dromosys opened this issue Jun 21, 2016 · 1 comment
Open

Sample fails with JSONException: No value for modules #2

dromosys opened this issue Jun 21, 2016 · 1 comment

Comments

@dromosys
Copy link

org.json.JSONException: No value for modules
06-21 10:28:55.681 9827-9827/weatherstation.netatmo.com.netatmo_api_android W/System.err: at org.json.JSONObject.get(JSONObject.java:389)
06-21 10:28:55.681 9827-9827/weatherstation.netatmo.com.netatmo_api_android W/System.err: at org.json.JSONObject.getJSONArray(JSONObject.java:584)
06-21 10:28:55.681 9827-9827/weatherstation.netatmo.com.netatmo_api_android W/System.err: at weatherstation.netatmo.com.netatmo_api_android.api.NetatmoUtils.parseMeasures(NetatmoUtils.java:173)
06-21 10:28:55.681 9827-9827/weatherstation.netatmo.com.netatmo_api_android W/System.err: at weatherstation.netatmo.com.netatmo_api_android.sample.MainActivity$2.onResponse(MainActivity.java:144)
06-21 10:28:55.681 9827-9827/weatherstation.netatmo.com.netatmo_api_android W/System.err: at weatherstation.netatmo.com.netatmo_api_android.sample.MainActivity$2.onResponse(MainActivity.java:134)

@roedll
Copy link

roedll commented Dec 13, 2017

I experienced the same problem.
If you change the method call

String moduleName = station.getString("module_name");
String id = station.getString("_id");

to

String id = module.getString("_id");
String name = module.optString("module_name", id);

it should work again...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants