JSON

JSON library, useful for sending data from Client’s Package to WebUI environment.

Note

nanos world implements a lightweight JSON library from https://github.com/rxi/json.lua.

Tip

This structure is Open Sourced at https://github.com/nanos-world/nanos-world-lua-lib/blob/master/json.lua. Feel free to push merge requests and suggest changes!

Usage

local encoded_value = JSON.stringify({ 1, 2, 3, { x = 10 } }) -- Returns '[1,2,3,{"x":10}]'

local decoded_value = JSON.parse('[1,2,3,{"x":10}]') -- Returns { 1, 2, 3, { x = 10 } }

Tip

You can use stringified data to send tables through Events (including remote ones) as well!

Functions

Returns

Name

Description

string

stringify(any value)

Returns a string representing value encoded in JSON

any value

parse(string str)

Returns a value representing the decoded JSON string