|
|
|
This property has the attributes { [[Writable]]: false , [[Enumerable]]: false , [[Configurable]]: true }. The JSON object: is %JSON% . is the initial value of the "JSON" . is an . contains two functions, parse parse and stringify stringify , that are used to parse and construct JSON texts. has a [[Prototype]] internal slot whose value is does not have a [[Construct]] internal method; it cannot be used as a with the new new operator. does not have a [[Call]] internal method; it cannot be invoked as a function. The JSON Data Interchange Format is defined in ECMA-404. The JSON interchange format used in this specification is JSON.parse JSON.parse and JSON.stringify JSON.stringify must support the exact interchange format described in the ECMA-404 specification without any deletions or extensions to The parse parse function parses a JSON text (a JSON-formatted String) and produces an ECMAScript value. The JSON format represents literals, arrays, and objects with a syntax similar to the syntax for ECMAScript literals, Array null . The optional reviver parameter is a function that takes two parameters, key and value . It can filter and transform the results. It is called with each of the key / value pairs produced by the parse, and its return value is used instead of the original value. If it returns what it received, the structure is not modified. If it returns undefined then the property is deleted from the result. 1. Let jsonString text ). 2. Parse ! jsonString ) as a JSON text as specified in ECMA-404. Throw a SyntaxError exception if it is not a valid JSON text as defined in that specification. 3. Let scriptString be the of "(" , jsonString , and ");" . 4. Let script be scriptString 5. : script . 6. Let completion be the result of evaluating script in must not be used during the evaluation. 7. Let unfiltered be completion .[[Value]]. 8. : unfiltered is either a String, Number, Boolean, Null, or an Object that is defined by either an . 9. If reviver ) is true , then a. Let root be ! ). b. Let rootName be the empty String. c. Perform ! ( root , rootName , unfiltered ). d. Return ? root , rootName , reviver ). 25.5 The JSON Object 25.5.1 JSON.parse ( text [ , reviver ] ) 736 |