Best way to get JSON from web and parse with Photon?

Hi guys, I’m a little lost in terms of options here, trying to find the easiest way to get JSON data from wunderground to use in my Spark Photon application. The wunderground API provides a strictly JSON page, but I’m not sure what’s the most current way to GET that data, and then parse it. I found the HTTPClient and SparkJson libraries, but HTTPClient doesn’t look to be really maintained and there’s little to no documentation, and without knowing how that works I can’t even get started with SparkJson.

It looks like I need to create a character array of the JSON data for parsing, but I’m not sure how I can loop through that; I’m a little rusty in the C++ world.

If there’s documentation out there I’d appreciate it, otherwise suggestions on libraries to use and methods to go at this would be greatly appreciated!

You could use this lib
https://build.particle.io/libs/SparkJson/0.0.2

But I’d rather use webhooks and let the Particle cloud do most the parsing and only forward the relevant data.

Searching and browsing this forum will give you lots of info about that.

2 Likes
2 Likes

Hi, Mr. scuffR your suggestion for using webhooks is grate. But I do not understand Docs tutorial for
using webhooks. I used a GUI to send 5 data parameters one a time to my photon. I had written 5 functions to receive the data one at a time with no problems. Now I have to send 8 groups of 5 data parameters each.
I would like to write 8 functions to receive 5 parameters each, but I don’t know how to change my function to receive 5 data parameters at once (JSON Format ). Someone else has don the GUI to send the JSON data which is calling (sending) 8 functions one at a time to the cloud with 5 data parameters each.
I would appreciate any help I can get

@kazemzahedi, take a look at the JsonParserGeneratorRK library on the web IDE. You can get the instructions on using it on @rickkas7’s library repo.

3 Likes

Thanks a lot, Sir, looks like I can use your example 3.
My GUI opens with a browser containing 2 containers which allow the users to input their data
By clicking SAVE1 or SAVE 2 data will be sent in a json format
Particle cloud expects to see a matching SAVE 1 and 2 to be happy
Now with your jsonParser what should I replace SAVE 1 with to coordinate with your Parser.
Please please help
Thanks