ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Shared functions
  3. fromJSON

Function

fromJSON

Server and clientMiscellaneousIdentical to MTA:SA

Reads JSON text and returns a Lua value. A top-level array (the way toJSON writes) unpacks into several results. Broken JSON gives nil and a warning with the error position.

Syntax

mixed fromJSON(string json)

Arguments

jsonstring
JSON text.

Returns

The decoded values or nil.

Example

local data = fromJSON('[{"money":500}]')
outputServerLog(data.money) -- 500

See also