9951 explained code solutions for 126 technologies


luaHow to parse JSON data


We'll use cjson module to convert table to string representation:

local cjson = require "cjson"
local tbl = cjson.decode('{"name":"Donald"}')ctrl + c
require "cjson"

load cjson module to work with JSON

cjson.decode

decodes given JSON string to table

tbl

table will contain decoded data from JSON string