JSON

suggest change

Introduction

JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write and easy for machines to parse and generate. It is important to realize that, in JavaScript, JSON is a string and not an object.

A basic overview can be found on the json.org website which also contains links to implementations of the standard in many different programming languages.

Syntax

Parameter

Parameter Details
JSON.parse Parse a JSON string
input(string) JSON string to be parsed.
reviver(function) Prescribes a transformation for the input JSON string.
JSON.stringify Serialize a serializable value
value(string) Value to be serialized according to the JSON specification.
replacer(function or String[] or Number[]) Selectively includes certain properties of the value object.
space(String or Number) If a number is provided, then space number of whitespaces will be inserted of readability. If a string is provided, the string (first 10 characters) will be used as whitespaces.

Remarks

The JSON utility methods were first standardized in ECMAScript 5.1 §15.12.

The format was formally defined in The application/json Media Type for JSON (RFC 4627 July 2006) which was later updated in The JSON Data Interchange Format (RFC 7158 March 2013, ECMA-404 October 2013 and RFC 7159 March 2014).

To make these methods available in old browsers such as Internet Explorer 8, use Douglas Crockford’s json2.js.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents