diff --git a/infra.bs b/infra.bs index 6561dd5..ef4a8a5 100644 --- a/infra.bs +++ b/infra.bs @@ -1848,24 +1848,28 @@ without breaking literal syntax used by their dependencies. In that case a tuple
The conventions used in the algorithms in this section are those of the JavaScript specification. [[!ECMA-262]] -
To parse a JSON string to a JavaScript value, -given a string |string|: +
To parse a JSON string to a JavaScript value, given a string |string|:
Return ? [$Call$](%JSON.parse%, undefined, « |string| »).
To parse JSON bytes to a JavaScript value, -given a byte sequence |bytes|: +
To parse JSON bytes to a JavaScript value, given a byte sequence +|bytes|:
Let |string| be the result of running UTF-8 decode on |bytes|. [[!ENCODING]]
Return the result of parsing a JSON string to a JavaScript value given |string|.
To serialize a JavaScript value to a JSON string, -given a JavaScript value |value|: +
To serialize a JavaScript value to a JSON string, given a JavaScript value +|value|:
Return |result|.
To serialize a JavaScript value to JSON bytes, -given a JavaScript value |value|: +
To serialize a JavaScript value to JSON bytes, given a JavaScript value +|value|:
Let |string| be the result of serializing a JavaScript value to a JSON string given @@ -1894,6 +1900,7 @@ given a JavaScript value |value|:
Return the result of running UTF-8 encode on |string|. [[!ENCODING]]
To parse a JSON string to an Infra value, +
To +parse a JSON string to an Infra value, given a string |string|:
Return the result of [=converting a JSON-derived JavaScript value to an Infra value=], given |jsValue|.
To parse JSON bytes to an Infra value, -given a byte sequence |bytes|: +
To parse JSON bytes to an Infra value, given a byte sequence |bytes|:
Let |string| be the result of running UTF-8 decode on |bytes|. [[!ENCODING]]
Return the result of parsing a JSON string to an Infra value given |string|.
To convert a JSON-derived JavaScript value to an Infra value, -given a JavaScript value |jsValue|: +
To convert a JSON-derived JavaScript value to an Infra value, given a JavaScript value +|jsValue|:
If |jsValue| is
Return |result|.
To serialize an Infra value to a JSON string, -given a string, boolean, number, null, list, or string-keyed map -|value|: +
To serialize an Infra value to a JSON string, given a string, +boolean, number, null, list, or string-keyed map |value|:
Let |jsValue| be the result of
@@ -1987,10 +2000,11 @@ given a string, boolean, number, null, list, or string
Since no additional arguments are passed to %JSON.stringify%, the resulting
string will have no whitespace inserted.
To serialize an Infra value to JSON bytes, -given a string, boolean, number, null, list, or string-keyed map -|value|: +
To serialize an Infra value to JSON bytes, given a string, +boolean, number, null, list, or string-keyed map |value|:
Let |string| be the result of serializing an Infra value to a JSON string, given
@@ -1998,10 +2012,10 @@ given a string, boolean, number, null, list, or string
Return the result of running UTF-8 encode on |string|. [[!ENCODING]]
To -convert an Infra value to a JSON-compatible JavaScript value, -given |value|: +
To convert an Infra value to a JSON-compatible JavaScript value, given |value|:
If |value| is a string, boolean, number, or null, then return |value|. @@ -2050,6 +2064,13 @@ given |value|:
Because it is rarely appropriate to manipulate JavaScript values directly in +specifications, prefer using serialize an Infra value to a JSON string or +serialize an Infra value to JSON bytes instead of using this algorithm. Please +file an issue to discuss your use case if +you believe you need to use convert an Infra value to a JSON-compatible JavaScript value. +