I’m attempting to pull data from a webpage using HttpClient. This is just raw JSON that I’m getting back, which I then parse using the SparkJSON library. My Photon keeps resetting, so I’m in the process of trying to troubleshoot my code.
My question: Is this an appropriate way to pull/parse the JSON data? Right now, the high level steps are:
Do an http.get to pull the data from the webpage on the same network.
Convert to a char[] using string.length+1 of the HTTP response.
Parse using the JSON library. Both dynamic and static buffers seem to crash on occasion, this might be how I’m parsing though.
Is there a more efficient way to run through these steps?
Can you tell me how you do the second point? I have tested to get json file from a server and also to convert a char[] json to fetch data. I will try to convert the json from my server and see if it fails too. So I can give you the example code in case it works.
Maybe the json file is too big and your photon is running out of memory so it crashes.
My JSON text is only ~300 characters. Not huge, but I was wondering if that would be enough to crash. I’ve tried both dynamic and static buffers. Is there a good way to check my memory utilization? Maybe there is a more efficient way to pull the JSON data?