diff --git a/spec.html b/spec.html index c5022b2..c344695 100644 --- a/spec.html +++ b/spec.html @@ -45,7 +45,7 @@

JSON.isRawJSON ( _O_ )

JSON.parse ( _text_ [ , _reviver_ ] )

The `parse` function parses a JSON text (a JSON-formatted String) and produces an ECMAScript language value. The JSON format represents literals, arrays, and objects with a syntax similar to the syntax for ECMAScript literals, Array Initializers, and Object Initializers. After parsing, JSON objects are realized as ECMAScript objects. JSON arrays are realized as ECMAScript Array instances. JSON strings, numbers, booleans, and null are realized as ECMAScript Strings, Numbers, Booleans, and *null*.

-

The optional _reviver_ parameter is a function that takes twothree parameters, _key_ and _value_ and a _context_ object. It can filter and transform the results. It is called with each of the _key_/_value_ pairs produced by the parse and details of their corresponding Parse Node, 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.

+

The optional _reviver_ parameter is a function that takes twothree parameters, _key_ and _value_ and a _context_ object. It can filter and transform the results. It is called with each of the _key_/_value_ pairs produced by the parse and (for primitive values) details of their corresponding Parse Node, 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_ be ? ToString(_text_). 1. [id="step-json-parse-validate"] Parse StringToCodePoints(_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. @@ -90,8 +90,9 @@

1. Let _typedValNode_ be ShallowestContained of _valNode_ with argument « |NullLiteral|, |BooleanLiteral|, |NumericLiteral|, |StringLiteral|, |ArrayLiteral|, |ObjectLiteral| ». 1. Assert: _typedValNode_ is not ~empty~. 1. Let _context_ be OrdinaryObjectCreate(%Object.prototype%). - 1. Let _sourceText_ be the source text matched by _typedValNode_. - 1. Perform ! CreateDataPropertyOrThrow(_context_, *"source"*, CodePointsToString(_sourceText_)). + 1. If _typedValNode_ is not an |ArrayLiteral| Parse Node and not an |ObjectLiteral| Parse Node, then + 1. Let _sourceText_ be the source text matched by _typedValNode_. + 1. Perform ! CreateDataPropertyOrThrow(_context_, *"source"*, CodePointsToString(_sourceText_)). 1. Let _val_ be ? Get(_holder_, _name_). 1. If Type(_val_) is Object, then 1. Let _isArray_ be ? IsArray(_val_).