From 00e2b03927b5c107aefef1c71ef14facd4c3cb77 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Tue, 1 Sep 2015 16:44:03 +0200 Subject: Move doc/ to documentation/api/ Signed-off-by: Jo-Philipp Wich --- doc/modules/luci.jsonc.html | 365 -------------------------------------------- 1 file changed, 365 deletions(-) delete mode 100644 doc/modules/luci.jsonc.html (limited to 'doc/modules/luci.jsonc.html') diff --git a/doc/modules/luci.jsonc.html b/doc/modules/luci.jsonc.html deleted file mode 100644 index 3d0a9ad2bb..0000000000 --- a/doc/modules/luci.jsonc.html +++ /dev/null @@ -1,365 +0,0 @@ - - - - Reference - - - - - -
- -
- -
-
-
- -
- - - -
- -

Class luci.jsonc

- -

- LuCI JSON parsing and serialization library. - The luci.jsonc class is a high level Lua binding to the JSON-C library to - allow reading and writing JSON data with minimal overhead.

- - - - - - - -

Functions

- - - - - - - - - - - - - - - - - -
new () - -Construct a new luci.jsonc.parser instance.
parse (json) - -Parse a complete JSON string and convert it into a Lua data structure.
stringify (data, pretty) - -Convert given Lua data into a JSON string.
- - - - - - -
-
- - -

Functions

-
- - - -
new ()
-
- - -Construct a new luci.jsonc.parser instance. - - - - - -

Usage:

-parser = luci.jsonc.new() - - - -

Return value:

-A luci.jsonc.parser object representing a JSON-C tokener. - - - -
- - - - -
parse (json)
-
- - -Parse a complete JSON string and convert it into a Lua data structure. - - -

Parameters

-
    - -
  • - json: A string containing the JSON data to parse, must be either a - JSON array or a JSON object. -
  • - -
- - - - -

Usage:

-
data = luci.jsonc.parse('{ "name": "John", "age": 34 }') 
-print(data.name)  -- "John"
- - - -

Return value:

-On success, a table containing the parsed JSON data is returned, on - failure the function returns nil and a string containing the reason of - the parse error. - - - -

See also:

- - -
- - - - -
stringify (data, pretty)
-
- - -Convert given Lua data into a JSON string. - -This function recursively converts the given Lua data into a JSON string, -ignoring any unsupported data. Lua tables are converted into JSON arrays if they -only contain integer keys, mixed tables are turned into JSON objects with any -existing numeric keys converted into strings. - -Lua functions, coroutines and userdata objects are ignored and Lua numbers are -converted to integers if they do not contain fractional values. - - - -

Parameters

-
    - -
  • - data: The Lua data to convert, can be a table, string, boolean or number. -
  • - -
  • - pretty: A boolean value indicating whether the resulting JSON should be - pretty printed. -
  • - -
- - - - -

Usage:

-
json = luci.jsonc.stringify({ item = true, values = { 1, 2, 3 } }) 
-print(json)  -- '{"item":true,"values":[1,2,3]}'
- - - -

Return value:

-Returns a string containing the JSON representation of the given Lua - data. - - - -

See also:

- - -
- - -
- - - - - -
- -
- -
-

Valid XHTML 1.0!

-
- -
- - -- cgit v1.2.3