Closed mhilbush closed 5 years ago
Were you able to find a workaround for this? I think it's too late to change for this version of the API
I figured v1 of the API could not be changed at this point. I haven't looked for a workaround yet. Definitely not if using the the fromJson
method. Sticking with Gson (since it's the standard JSON package in openHAB), the JsonReader class looks the most promising. I just haven't had a chance to try it out yet.
I had brought this up in Beta and was rejected.
and was rejected
Why? It's a real issue (at least for Java implementations).
It is for go as well. Go look at the earlier issues. @owise1 didn't want to change it.
Really? I'm not sure why I would have had an opinion about this. It may have been an oversight.
Just wanted to close this out. I was able to confirm that I can extract the 24hourrain
element (albeit inefficiently) using Gson's JsonReader object.
I would recommend in the future to avoid creating JSON names that start with numbers.
sorry for the inconvenience and thanks for your feedback.
Looking at the device data soecs here... https://github.com/ambient-weather/api-docs/wiki/Device-Data-Specs
When using Gson's
fromJson
method to parse the device data JSON, the class fields must have the same name as the name in the JSON. In the case of 24hourrain, Java class fields cannot start with a number.