You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: srfi-180.html
+18-18Lines changed: 18 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -52,35 +52,35 @@ <h2 id="author">Author</h2>
52
52
<h2id="status">Status</h2>
53
53
<p>Draft</p>
54
54
<h2id="abstract">Abstract</h2>
55
-
<p>This library describes a JavaScript Object Notation (<ahref="https://www.json.org/">JSON</a>) parser and printer. It does support to stream parse JSON that is possibly bigger than memory.</p>
55
+
<p>This library describes a JavaScript Object Notation (JSON) parser and printer. It supports streaming parses of JSON that may be bigger than memory.</p>
56
56
<h2id="rationale">Rationale</h2>
57
-
<p>JSON is a defacto industry standard to exchange data.</p>
58
-
<p>For best interoperability the sample implementation is based on <ahref="https://tools.ietf.org/html/rfc7159">RFC7159</a>, and the tests are based on <ahref="https://github.com/nst/JSONTestSuite/">JSONTestSuite</a>.</p>
59
-
<p>The mapping between JSON types and Scheme objects is not trivial because a given mapping might not be the best for every situations. That is one of the reason why this library expose a stream reader, in order to allow users to specify the scheme representation and have efficient code.</p>
57
+
<p><ahref="https://www.json.org/">JSON</a> is a <i>de facto</i>industry standard for data exchange.</p>
58
+
<p>For best interoperability, the sample implementation is based on <ahref="https://tools.ietf.org/html/rfc7159">RFC7159</a>, and the tests are based on <ahref="https://github.com/nst/JSONTestSuite/">JSONTestSuite</a>.</p>
59
+
<p>The mapping between JSON types and Scheme objects is not trivial because a given mapping might not be the best for every situation. That is one of the reasons that this library exposes a stream reader, which allows users to specify the Scheme representation and have efficient code.</p>
<p>Returns <code>#t</code> is <code>OBJ</code> is an error object. This exception can be raised during <code>json-stream-read</code>, <code>json-read</code> or <code>json-write</code>.</p>
<p>Return <code>#t</code> if <code>OBJ</code> is the scheme symbol <code>'null</code> representing in Scheme the JSON <code>null</code>. In any other cases, return <code>#f</code>.</p>
66
+
<p>Return <code>#t</code> if <code>OBJ</code> is the scheme symbol <code>'null</code>, which represents the JSON <code>null</code> in Scheme. In all other cases, return <code>#f</code>.</p>
<p>Streaming event-based JSON reader. <code>PORT</code> must be a textual input port. The default value of <code>PORT</code> is the value returned by the procedure <code>current-input-port</code>. The returned value is unspecified.</p>
69
-
<p><code>json-stream-read</code> should raise an object that satisfy the predicate <code>json-error?</code> in cases where the JSON is invalid.</p>
70
-
<p><code>json-stream-read</code> will call <code>PROC</code> with two arguments. The first argument is the event <code>type</code>, the second argument is the event <code>obj</code>. Since the value that can be taken by <code>obj</code> depends on the value of <code>type</code>, they are presented together in the following paragraph.</p>
71
-
<p>The first arguments is noted<code>type</code>. It is a symbol. It can be the following:</p>
69
+
<p><code>json-stream-read</code> should raise an object that satisfies the predicate <code>json-error?</code> in cases where the JSON is invalid.</p>
70
+
<p><code>json-stream-read</code> will call <code>PROC</code> with two arguments. The first argument is the event <code>type</code>, and the second argument is the event <code>obj</code>. Since the value that can be taken by <code>obj</code> depends on the value of <code>type</code>, they are presented together in the following paragraph.</p>
71
+
<p>The first arguments is denoted<code>type</code>. It is a symbol. It can be the following:</p>
72
72
<ul>
73
73
<li><code>'json-structure</code></li>
74
74
<li><code>'json-value</code></li>
75
75
</ul>
76
-
<p>The <code>obj</code> argument can take the following values dependings on <code>type</code>:</p>
76
+
<p>The <code>obj</code> argument can take the following values depending on <code>type</code>:</p>
77
77
<ul>
78
78
<li><p>If type is <code>'json-structure</code>, then <code>obj</code> can be:</p>
79
79
<ul>
80
80
<li><p><code>'array-open</code> symbol denoting that an array should be constructed.</p></li>
81
-
<li><p><code>'array-close</code> symbol denoting that the construction of the array for which the last <code>'array-open</code> was emitted and not closed, is finished.</p></li>
82
-
<li><p><code>'object-open'</code> symbol denoting that an object should be constructed. The object's key-value pairs are emitted in sequence like property list (plist). The keys will be produced by <code>(proc 'json-structure some-symbol)</code>, that is, the key is always a symbol. The production of the key is always followed by the production of a value. Otherwise, the JSON would be invalid and <code>json-stream-read</code> would raise error. The production of the value can be a <code>'json-value</code> but can also be <code>'json-structure</code> with <code>obj</code> strictly equivalent <code>'array-open</code> or <code>'object-open</code>. This events will be followed by other events. Eventually, an associated <code>'object-close</code> event is emitted.</p></li>
83
-
<li><p><code>'object-close</code> symbol denoting that the construction of the object for which the last <code>object-open</code> was emitted and not closed, is finished.</p></li>
81
+
<li><p><code>'array-close</code> symbol denoting that the construction of the array for which the last <code>'array-open</code> was emitted and not closed is finished.</p></li>
82
+
<li><p><code>'object-open</code> symbol denoting that an object should be constructed. The object's key-value pairs are emitted in sequence like those in a property list (plist). The keys will be produced by <code>(proc 'json-structure some-symbol)</code>, that is, the key is always a symbol. The production of the key is always followed by the production of a value. Otherwise, the JSON would be invalid and <code>json-stream-read</code> would raise error. The production of the value can be a <code>'json-value</code> but can also be <code>'json-structure</code> with <code>obj</code> strictly equivalent <code>'array-open</code> or <code>'object-open</code>. These events will be followed by other events. Eventually, an associated <code>'object-close</code> event is emitted.</p></li>
83
+
<li><p><code>'object-close</code> symbol denoting that the construction of the object for which the last <code>object-open</code> was emitted and not closed is finished.</p></li>
84
84
</ul></li>
85
85
<li><p>If type is <code>'json-value</code>, then <code>obj</code> is scheme object that can be of the following types:</p>
<p><strong>Note:</strong> This document does not prescribes a validating parser. But in cases where the input JSON is valid, <code>json-parse</code> must emit the correct sequence of events.</p>
93
-
<p><strong>Note:</strong> Given <code>type</code> is <code>'json-value</code>, then there is two occasions where <code>obj</code> can be a symbol: 1) the JSON contains a <code>null</code> value, in that case <code>'null</code> symbol is produced; 2) In a JSON object, keys are produced with the type <code>'json-value</code> and the <code>obj</code> as a symbol. In particular the key <code>"null"</code> will be represented with <code>'null</code> symbol and JSON <code>null</code> too: that does not have bad consequences for the user.</p>
92
+
<p><strong>Note:</strong> This document does not prescribe a validating parser. But in cases where the input JSON is valid, <code>json-parse</code> must emit the correct sequence of events.</p>
93
+
<p><strong>Note:</strong> Given that <code>type</code> is <code>'json-value</code>, there are two occasions where <code>obj</code> can be a symbol: 1) the JSON contains a <code>null</code> value, in that case <code>'null</code> symbol is produced; 2) In a JSON object, keys are produced with the type <code>'json-value</code> and the <code>obj</code> as a symbol. In particular the key <code>"null"</code> will be represented with <code>'null</code> symbol and JSON <code>null</code> too, but that does not have bad consequences for the user.</p>
<p>JSON writer procedure. <code>PORT</code> must be a textual output port. The default value of <code>PORT</code> is the value returned by the procedure <code>current-output-port</code>. The returned value is unspecified.</p>
132
-
<p><code>json-write</code> will validate that <code>OBJ</code> can be serialized into JSON before writing to <code>PORT</code>. In the case where <code>OBJ</code> is not an object or composition of the following types, an error that satisfy<code>json-error?</code> is raised:</p>
132
+
<p><code>json-write</code> will validate that <code>OBJ</code> can be serialized into JSON before writing to <code>PORT</code>. In the case where <code>OBJ</code> is not an object or composition of the following types, an error that satisfies<code>json-error?</code> is raised:</p>
0 commit comments