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|:

  1. 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|:

  1. Let |string| be the result of running UTF-8 decode on |bytes|. [[!ENCODING]]

  2. 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|:

  1. @@ -1884,9 +1888,11 @@ given a JavaScript value |value|:
  2. 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|:

  1. Let |string| be the result of serializing a JavaScript value to a JSON string given @@ -1894,6 +1900,7 @@ given a JavaScript value |value|:

  2. Return the result of running UTF-8 encode on |string|. [[!ENCODING]]

+

@@ -1902,7 +1909,9 @@ the involved objects or arrays are tied to a particular JavaScript standards, it is often more convenient to convert between JSON and realm-independent maps, lists, strings, booleans, numbers, and nulls. -

To parse a JSON string to an Infra value, +

+

To +parse a JSON string to an Infra value, given a string |string|:

    @@ -1911,18 +1920,21 @@ given a string |string|:
  1. 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|:

  1. Let |string| be the result of running UTF-8 decode on |bytes|. [[!ENCODING]]

  2. 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|:

  1. If |jsValue| is null, |jsValue| [=is a Boolean=], |jsValue| @@ -1972,10 +1984,11 @@ given a JavaScript value |jsValue|:

  2. 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|:

  1. Let |jsValue| be the result of @@ -1987,10 +2000,11 @@ given a string, boolean, number, null, list, or stringSince 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|:

  1. 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|:

  1. 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. +

+

Forgiving base64