Hey guys, I’ve been working at this issue for almost two hours and have had no progress thus far. This is my first time really using the forums for help, so I hope this goes well!
I am using a third-party library (https://github.com/vsergeyev/corona-firebase) to use FireBase’s REST API as a form of backend. All I am doing is grabbing location data from the app, adding some text, and sending it to FireBase. That part of my app works perfectly with no errors.
I can grab the data fine through the REST API, when I print the raw JSON data it comes out perfectly. Yet, after I use JSON Decode, the data becomes nill and I can’t even use it.
I printed the raw JSON code and this comes out:
{ "-KQ9r2jNNYW6BmxA8pUC":{ "location":[10,-10], "text":"Hey Corona! Here’s some data for y’all!" } }
And then I tried taking that raw JSON string and decoding it, followed up by a simple print.
local dataPulled = (json.decode(event.response)) -- event.response IS the proper JSON data, I made sure or the first print wouldn't have worked print(dataPulled[0])
That prints a complete nil. I used a library from one of the Corona tutorials to try to print out the contents of dataPulled, and got:
--The print\_r library print\_r(dataPulled) --[[Returns: table: 0x7f89862ee080 { Aug 27 03:23:40.065 [-KQ9r2jNNYW6BmxA8pUC] =\> table: 0x7f89862ee080 { Aug 27 03:23:40.065 [location] =\> table: 0x7f8987acc370 { Aug 27 03:23:40.082 [1] =\> 10 Aug 27 03:23:40.083 [2] =\> -10 Aug 27 03:23:40.083 } Aug 27 03:23:40.083 [text] =\> "Hey Corona! Here’s some data for y’all!" Aug 27 03:23:40.083 } Aug 27 03:23:40.083 } ]]
How can I actually check the data?
Please let me know.