Good afternoon,
I’m closing in on getting this project working, but had a question on the new documentation for the JSON Parser and Generator in Device OS, recently posted by @rickkas7.
I have the following JSON, and the parser is only returning the top level JSON element in the object (if that’s the right terminology):
{ “daily”: [ { “dt”:1589475600, “rain”: } { “dt”:1589562000, “rain”: } { “dt”:1589648400, “rain”: } { “dt”:1589734800, “rain”: } { “dt”:1589821200, “rain”:8.32 } { “dt”:1589907600, “rain”:0.39 } { “dt”:1589994000, “rain”:1.28 } { “dt”:1590080400, “rain”:0.73 } ] }
The iterator returns “daily” and stops on the first iteration, based on this example code from the documentation.
I think what I need to know is how to iterate on an object within the key of another object, as stated here:
“Construct an iterator from a JSONValue. This can be the whole object, or you can use it to iterate an object within the key of another object.”
Unfortunately, while the documentation has helped immensely, there’s no example of how to accomplish this specifically, and I’ve been unsuccessful through trial and error.
Simply put, how do I reference and or iterate through sub-elements of an object using this parser?
Thanks in advance for your time.
-RC