Created
December 3, 2014 08:19
-
-
Save ferminhg/ec11f273b2da11bed713 to your computer and use it in GitHub Desktop.
Corona SDK - Working with JSON
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| local json = require "json" | |
| --Lua script: | |
| local luaTable = { | |
| ["name1"] = "value1", | |
| ["name2"] = {1, false, true, 23.54, "a string"}, | |
| name3 = json.null | |
| } | |
| local jsonData = json.encode( luaTable ) | |
| print (jsonData) | |
| local data = json.decode( jsonData ) | |
| print (data.name2[4]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment