Javascript JSON

From Yate Documentation
Revision as of 11:46, 14 July 2014 by Paulc (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

JSON parsing global object.

Methods

  • parse(str)

Parse JSON string.

Parameters:
str String containing JSON data
Return:
Primitive type or object representing the data, undefined if parsing failed.

  • stringify(obj,unused,spaces)

Stringify a Javascript primitive or object.

Parameters:
obj Object of primitive type
unused Unused optional parameter, for compatibility with the standard
spaces Optional number of spaces to use for indentation
Return:
String JSON data, undefined is an error occured.

  • loadFile(name)

Parse JSON file (non-standard method).

Parameters:
name Name of the file containing JSON data
Return:
Primitive type or object representing the data, undefined if parsing failed.

  • saveFile(name,obj,spaces)

Save JSON data in a file (non-standard method).

Parameters:
name Name of the JSON file to write unused Unused optional parameter, for compatibility with the standard
spaces Optional number of spaces to use for indentation
Return:
TRUE if operation succeeded, FALSE if an error occured.

Personal tools
Namespaces

Variants
Actions
Preface
Configuration
Administrators
Developers