6.81. kink/json/JSON_VAL

JSON values are values which can be converted from or to a JSON string by kink/json/JSON module.

JSON values are as follows.

JSON null

JSON_VAL.null.

JSON true, false

`true` and `false`.

JSON numbers

`num` values.

JSON strings

`str` values.

Use of unpaired surrogate code points are allowed, but discouraged.

JSON arrays

`vec` values where the elements are JSON values.

JSON objects

`map` values, where the keys are `str` values with the equivalence relation by `==` operator, and values are JSON values.

Use of unpaired surrogate code points in keys are allowed, but discouraged.

6.81.1. JSON_VAL.null

`null` returns JSON null.

6.81.2. JSON_VAL.null?(Val)

`null?` returns whether `Val` is a JSON null.

Precondition

`Val` must be a JSON value.

6.81.3. JSON_VAL.is?(Val)

`is?` returns whether `Val` is a JSON value.

6.81.4. JSON_VAL.eq?(X Y)

`eq?` returns whether `X` and `Y` are equivalent JSON values.

Equivalence

`eq?` is an equivalence relation which satisfies reflexivity, symmetry, and transitivity.

• JSON.null is equivalent to JSON.null.

• `true` is equivalent to `true`.

• `false` is equivalent to `false`.

• Two `num` values are equivalent when `==` operator returns `true`.

• Two `num` values are equivalent when `==` operator returns `true`.

• Two `vec` values are equivalent when they have the same number of elements, and the elements of `vec` values at the same indexes are equivalent.

• Two `map` values are equivalent when they have the equal set of keys under `==` operator of `str`, and the values of `map` values at the equal keys are equivalent.

Preconditions

`X` and `Y` must be JSON values.