Skip to main content

json

Description:

  JSON library for Dora.

load

Type: Function.

Description:

  Parses the specified JSON text and returns the corresponding table.

Signature:

load: function(json: string, maxDepth?: integer): table | nil, nil | string

Parameters:

ParameterTypeDescription
jsonstringThe JSON text to parse.
maxDepthnumber[optional] The maximum depth of parsing (default is 128).

Returns:

Return TypeDescription
table | nil, nil | stringThe table representing the JSON data, or nil with an error message if the JSON text cannot be parsed.

dump

Type: Function.

Description:

  Dumps the specified table into a JSON text.

Signature:

dump: function(tab: table): string | nil, nil | string

Parameters:

ParameterTypeDescription
tabtableThe table to dump.

Returns:

Return TypeDescription
stringThe JSON text representing the table, or nil with an error message if the table cannot be dumped.

null

Type: Field.

Description:

  Represents a JSON null value.

Signature:

null: JsonNull