Skip to content

Commit fe329e5

Browse files
committed
Use ECMASCRIPT number serialization for serializing JSON numerics.
1 parent 353f804 commit fe329e5

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

common/jsonld.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const jsonld = {
1818
},
1919
"JCS": {
2020
title: "JSON Canonicalization Scheme (JCS)",
21-
href: 'https://tools.ietf.org/html/draft-rundgren-json-canonicalization-scheme-05#page-6',
21+
href: 'https://tools.ietf.org/html/draft-rundgren-json-canonicalization-scheme-05',
2222
authors: ['A. Rundgren', 'B. Jordan', 'S. Erdtman'],
2323
publisher: 'Network Working Group',
2424
status: 'Internet-Draft',

index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4742,8 +4742,8 @@ <h2>Data Round Tripping</h2>
47424742
<ul class="changed">
47434743
<li>Serialize JSON using no unnecessary whitespace,</li>
47444744
<li>Keys in objects SHOULD be ordered lexicographically,</li>
4745-
<li>Native Boolean and Numeric values SHOULD be serialized as described elsewhere in this section
4746-
for <a href="#deserialize-json-ld-to-rdf-algorithm">deserializing JSON-LD to RDF</a>,</li>
4745+
<li>Native Numeric values SHOULD be serialized according to
4746+
<a data-cite="?ECMASCRIPT#sec-tostring-applied-to-the-number-type">Section 7.1.12.1</a> of [[?ECMASCRIPT]],</li>
47474747
<li>Strings SHOULD be serialized with Unicode codepoints from <code>U+0000</code> through <code>U+001F</code>
47484748
using lowercase hexaddecimal Unicode notation (<code>\uhhhh</code>) unless in the set
47494749
of predefined JSON control characters <code>U+0008</code>, <code>U+0009</code>,
@@ -4770,7 +4770,7 @@ <h2>Data Round Tripping</h2>
47704770
{
47714771
"@context": {
47724772
"@version": 1.1,
4773-
"e": {"@id": "http://example.org/vocab#c14n", ****"@type": "@json"****}
4773+
"e": {"@id": "http://example.org/vocab#json", ****"@type": "@json"****}
47744774
},
47754775
"e": ****[
47764776
56.0,
@@ -4797,7 +4797,7 @@ <h2>Data Round Tripping</h2>
47974797
<!--
47984798
@prefix ex: <http://example.org/vocab#> .
47994799
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
4800-
[ex:c14n ****"""[56,{"1":[],"10":null,"d":true}]"""^^rdf:JSON****] .
4800+
[ex:json ****"""[56,{"1":[],"10":null,"d":true}]"""^^rdf:JSON****] .
48014801
-->
48024802
</pre>
48034803
</aside>

tests/toRdf/js03-out.nq

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
_:b0 <http://example.org/vocab#double> "1.23E0"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#JSON> .
1+
_:b0 <http://example.org/vocab#double> "1.23"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#JSON> .

tests/toRdf/js12-in.jsonld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"e": {"@id": "http://example.org/vocab#c14n", "@type": "@json"}
55
},
66
"e": {
7-
"numbers": [333333333.333333, 1E20, 4.50, 2e-3, 0.000000000000000000000000001],
7+
"numbers": [333333333.33333329, 1E30, 4.50, 2e-3, 0.000000000000000000000000001],
88
"string": "\u20ac$\u000F\u000aA'\u0042\u0022\u005c\\\"\/",
99
"literals": [null, true, false]
1010
}

tests/toRdf/js12-out.nq

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
_:b0 <http://example.org/vocab#c14n> "{\"literals\":[null,true,false],\"numbers\":[3.33333333333333E8,100000000000000000000,4.5E0,2.0E-3,1.0E-27],\"string\":\"€$\\u000f\\nA'B\\\"\\\\\\\\\\\"/\"}"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#JSON> .
1+
_:b0 <http://example.org/vocab#c14n> "{\"literals\":[null,true,false],\"numbers\":[333333333.3333333,1e+30,4.5,0.002,1e-27],\"string\":\"€$\\u000f\\nA'B\\\"\\\\\\\\\\\"/\"}"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#JSON> .

0 commit comments

Comments
 (0)