Skip to content

Commit 63a9614

Browse files
committed
Add a canonical mapping section, noting that it is non-normative. Based on the API Data Round Tripping text.
1 parent 2a50449 commit 63a9614

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

index.html

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11420,13 +11420,43 @@ <h3>Serializing/Deserializing RDF</h3>
1142011420
<a data-cite="ECMASCRIPT#sec-strict-equality-comparison">Strict Equality Comparison</a>
1142111421
defined in <a data-cite="ECMASCRIPT#sec-strict-equality-comparison">Section 7.2.15</a> in [[ECMASCRIPT]].</li>
1142211422
<li>Otherwise, <var>A</var> and <var>B</var> are not equal.</li>
11423-
</ul>
11423+
</ol>
1142411424
</dd>
1142511425
<dt>The lexical-to-value mapping</dt>
1142611426
<dd>is the result of parsing the lexical representation into
1142711427
an internal representation consistent with [[ECMASCRIPT]] representation
1142811428
created by using the <code>JSON.parse</code> function as defined in
1142911429
<a data-cite="ECMASCRIPT#sec-json-object">Section 24.5 The JSON Object</a> of [[ECMASCRIPT]].</dd>
11430+
<dt>The canonical mapping</dt>
11431+
<dd>is non-normative, as a normative recommendation for
11432+
JSON canonicalization is not yet defined. Implementations
11433+
SHOULD use the following guidelines when creating the lexical
11434+
representation of a <a>JSON literal</a>:
11435+
11436+
<ul class="changed">
11437+
<li>Serialize JSON using no unnecessary whitespace,</li>
11438+
<li>Keys in objects SHOULD be ordered lexicographically,</li>
11439+
<li>Native Numeric values SHOULD be serialized according to
11440+
<a data-cite="?ECMASCRIPT#sec-tostring-applied-to-the-number-type">Section 7.1.12.1</a> of [[?ECMASCRIPT]],</li>
11441+
<li>Strings SHOULD be serialized with Unicode codepoints from <code>U+0000</code> through <code>U+001F</code>
11442+
using lowercase hexaddecimal Unicode notation (<code>\uhhhh</code>) unless in the set
11443+
of predefined JSON control characters <code>U+0008</code>, <code>U+0009</code>,
11444+
<code>U+000A</code>, <code>U+000C</code> or <code>U+000D</code>
11445+
which SHOULD be serialized as <code>\b</code>, <code>\t</code>, <code>\n</code>, <code>\f</code> and <code>\r</code> respectively.
11446+
All other Unicode characters SHOULD be serialized "as is", other than
11447+
<code>U+005C</code> (<code>\</code>) and <code>U+0022</code> (<code>"</code>)
11448+
which SHOULD be serialized as <code>\\</code> and <code>\"</code> respectively.</li>
11449+
</ul>
11450+
11451+
<div class="issue changed">The JSON Canonicalization Scheme [[?JCS]]
11452+
is an emerging standard for JSON canonicalization
11453+
not yet ready to be referenced.
11454+
When a JSON canonicalization standard becomes available,
11455+
this specification will likely be updated to require such a canonical representation.
11456+
Users are cautioned from depending on the
11457+
<a>JSON literal</a> lexical representation as an <a>RDF literal</a>,
11458+
as the specifics of serialization may change in a future revison of this document.</div>
11459+
</dd>
1143011460
</dl>
1143111461
</section>
1143211462
</section>

0 commit comments

Comments
 (0)