Amir
Amir

Reputation: 1683

Decoding json from parse.com in Corona SDK

I need to decode the data received from parse.com in Corona SDK.

The example I get is below (not sure if I can get rid of "results" in the beginning before receiving in app):

{"results":[{"v":20,"x2":25.200001,"y2":55.250001,"y1":55.200001 ...

Corona says json.decode(event.response) should convert this to a lua table while I get an empty table. Can someone give me a working example? Many thanks

Upvotes: 0

Views: 699

Answers (1)

Amir
Amir

Reputation: 1683

I guess I was trying to get results in a wrong way This way it works:

local d = json.decode(event.response) 
print(d.results[1].x2)

Upvotes: 2

Related Questions