@@ -12858,48 +12858,15 @@ <h3>Serializing/Deserializing RDF</h3>
12858
12858
<dd>is the set of UNICODE [[UNICODE]] strings which conform to the <a data-cite="JSON#section-2">JSON Grammar</a>
12859
12859
as described in <a data-cite="RFC8259#section-2">Section 2 JSON Grammar</a> of [[RFC8259]].</dd>
12860
12860
<dt>The value space</dt>
12861
- <dd class="algorithm">is the union of the four primitive types (<a>strings</a>, <a>numbers</a>, <a>booleans</a>,
12862
- and <a>null</a>) and two structured types (<a>objects</a> and <a>arrays</a>)
12863
- from [[ECMASCRIPT]].
12864
- Two JSON values <var>A</var> and <var>B</var> are considered equal if and only if the following is true:
12865
- <ol>
12866
- <li>If <var>A</var> and <var>B</var> are both <a>objects</a>,
12867
- both <var>A</var> and <var>B</var> have the same number of <a>entries</a>,
12868
- and each <a>entry</a> in <var>A</var> is equal to a corresponding <a>entry</a> in <var>B</var>
12869
- where <ul>
12870
- <li>the keys are equal (as defined in <a data-cite="ECMASCRIPT#sec-samevaluenonnumber">Section 7.2.13, step 5.a</a>
12871
- in [[ECMASCRIPT]]), and</li>
12872
- <li>the values are considered equal through
12873
- applying this comparison recursively.</li>
12874
- </ul>
12875
- <li>Otherwise, if <var>A</var> and <var>B</var> are both <a>arrays</a>,
12876
- both <var>A</var> and <var>B</var> have the same number of elements,
12877
- and each element <var>A<sub>i</sub></var> is considered
12878
- equal to the corresponding element <var>B<sub>i</sub></var>
12879
- through applying this comparison recursively.</li>
12880
- <li>Otherwise, if <var>A</var> and <var>B</var> satisfy the
12881
- <a data-cite="ECMASCRIPT#sec-strict-equality-comparison">Strict Equality Comparison</a>
12882
- defined in <a data-cite="ECMASCRIPT#sec-strict-equality-comparison">Section 7.2.16</a> in [[ECMASCRIPT]].</li>
12883
- <li>Otherwise, <var>A</var> and <var>B</var> are not equal.</li>
12884
- </ol>
12885
- </dd>
12886
- <dt>The lexical-to-value mapping</dt>
12887
- <dd>is the result of parsing the lexical representation into
12888
- an internal representation consistent with [[ECMASCRIPT]] representation
12889
- created by using the <code>JSON.parse</code> function as defined in
12890
- <a data-cite="ECMASCRIPT#sec-json-object">Section 24.5 The JSON Object</a> of [[ECMASCRIPT]].</dd>
12891
- <dt>The canonical mapping</dt>
12892
- <dd>is non-normative, as a normative recommendation for
12893
- JSON canonicalization is not yet defined. Implementations
12894
- SHOULD use the following guidelines when creating the lexical
12895
- representation of a <a>JSON literal</a>:
12896
-
12897
- <ul class="changed">
12898
- <li>Serialize JSON using no unnecessary whitespace,</li>
12899
- <li>Keys in objects SHOULD be ordered lexicographically,</li>
12900
- <li>Native Numeric values SHOULD be serialized according to
12861
+ <dd class="changed">is the set of UNICODE [[UNICODE]] strings which conform to the <a data-cite="JSON#section-2">JSON Grammar</a>
12862
+ as described in <a data-cite="RFC8259#section-2">Section 2 JSON Grammar</a> of [[RFC8259]],
12863
+ and furthermore comply with the following constraints:
12864
+ <ul>
12865
+ <li>It MUST not contain any unnecessary whitespace,</li>
12866
+ <li>Keys in objects MUST be ordered lexicographically,</li>
12867
+ <li>Native Numeric values MUST be serialized according to
12901
12868
<a data-cite="?ECMASCRIPT#sec-tostring-applied-to-the-number-type">Section 7.1.12.1</a> of [[?ECMASCRIPT]],</li>
12902
- <li>Strings SHOULD be serialized with Unicode codepoints from <code>U+0000</code> through <code>U+001F</code>
12869
+ <li>Strings MUST be serialized with Unicode codepoints from <code>U+0000</code> through <code>U+001F</code>
12903
12870
using lower case hexadecimal Unicode notation (<code>\uhhhh</code>) unless in the set
12904
12871
of predefined JSON control characters <code>U+0008</code>, <code>U+0009</code>,
12905
12872
<code>U+000A</code>, <code>U+000C</code> or <code>U+000D</code>
@@ -12908,7 +12875,6 @@ <h3>Serializing/Deserializing RDF</h3>
12908
12875
<code>U+005C</code> (<code>\</code>) and <code>U+0022</code> (<code>"</code>)
12909
12876
which SHOULD be serialized as <code>\\</code> and <code>\"</code> respectively.</li>
12910
12877
</ul>
12911
-
12912
12878
<div class="issue changed">The JSON Canonicalization Scheme [[?JCS]]
12913
12879
is an emerging standard for JSON canonicalization
12914
12880
not yet ready to be referenced.
@@ -12917,7 +12883,25 @@ <h3>Serializing/Deserializing RDF</h3>
12917
12883
Users are cautioned from depending on the
12918
12884
<a>JSON literal</a> lexical representation as an <a>RDF literal</a>,
12919
12885
as the specifics of serialization may change in a future revision of this document.</div>
12886
+ Despite being defined as a set of strings,
12887
+ this value space is considered distinct from the value space of `xsd:string`,
12888
+ in order to avoid side effects with existing specifications.
12920
12889
</dd>
12890
+ <dt>The lexical-to-value mapping</dt>
12891
+ <dd>maps any element of the lexical space to the result of
12892
+ <ol>
12893
+ <li>parsing it into
12894
+ an internal representation consistent with [[ECMASCRIPT]] representation
12895
+ created by using the <code>JSON.parse</code> function as defined in
12896
+ <a data-cite="ECMASCRIPT#sec-json-object">Section 24.5 The JSON Object</a> of [[ECMASCRIPT]],</li>
12897
+ <li>then serializing it in the JSON format [[RFC8259]]
12898
+ in compliance with the constraints of the value space described above.
12899
+ </li>
12900
+ </ol>
12901
+ </dd>
12902
+ <dt>The canonical mapping</dt>
12903
+ <dd>maps any element of the value space to the identical string in the lexical space.</dd>
12904
+
12921
12905
</dl>
12922
12906
</section>
12923
12907
0 commit comments