Skip to content

class JSON (shared-side)

This class represents JSON utilities.

Properties

No properties.


Methods

dump_utf8

Available since version: 0.4.0

This method will dump json as a text encoded via utf8.

string dump_utf8(array|table value, int indent = -1, int indent_chat, bool ensure_ascii = false)

Parameters:

  • array|table value: the value that will be dumped as json.
  • int indent: the number that reperesents how many times indentation character will be placed.
  • int indent_chat: =' ' the indentation character.
  • bool ensure_ascii: If ensure_ascii is true, all non-ASCII characters in the output are escaped with \uXXXX sequences, and the result consists of ASCII characters only.

Returns string:

the dumped json as text.


dump_ansi

Available since version: 0.4.0

This method will dump json as a text encoded via ansi.

string dump_ansi(array|table value, int indent = -1, int indent_chat, bool ensure_ascii = false)

Parameters:

  • array|table value: the value that will be dumped as json.
  • int indent: the number that reperesents how many times indentation character will be placed.
  • int indent_chat: =' ' the indentation character.
  • bool ensure_ascii: If ensure_ascii is true, all non-ASCII characters in the output are escaped with \uXXXX sequences, and the result consists of ASCII characters only.

Returns string:

the dumped json as text.


parse_utf8

Available since version: 0.4.0

This method will parse json text encoded via utf8 and returne the appropiate object.

array|table parse_utf8(string text)

Parameters:

  • string text: the text that you want to parse.

Returns array|table:

the parsed object.


parse_ansi

Available since version: 0.4.0

This method will parse json text encoded via ansi and returne the appropiate object.

array|table parse_ansi(string text)

Parameters:

  • string text: the text that you want to parse.

Returns array|table:

the parsed object.


Callbacks

No callbacks.