Skip to content
velt/encoding/json exports

velt/encoding/json

API reference

JSON is a global, as in JavaScript: it needs no import. JSON.parse<T>(text) decodes into a type you name and checks the text against it, JSON.stringify(x) writes any value with a JSON form as Node writes it, and JsonValue holds JSON whose shape you don't know. For a walkthrough, read the guide.

import { appendJsonNumber, Value } from "velt/encoding/json";

Exports

function

appendJsonNumber

#std/encoding/json/append.vlt:22

Re-exported from velt/encoding/json/append

function appendJsonNumber(out: StringBuilder, x: f64): void

Appends x as JSON.stringify writes a number (null for NaN and the infinities).

function

appendJsonString

#std/encoding/json/append.vlt:17

Re-exported from velt/encoding/json/append

function appendJsonString(out: StringBuilder, s: string): void

Appends s as a JSON string: quoted, with ", \, control characters and lone surrogates escaped.

function

appendJsonUint

#std/encoding/json/append.vlt:27

Re-exported from velt/encoding/json/append

function appendJsonUint(out: StringBuilder, n: u64): void

Appends the decimal digits of an unsigned integer (every u64, unlike an f64).

function

appendJsonValue

#std/encoding/json/append.vlt:32

Re-exported from velt/encoding/json/append

function appendJsonValue(out: StringBuilder, v: JsonValue): void

Appends the JSON text of v (what v.stringify() returns), without making a string of it.

Re-exported from velt/encoding/json/generated

function writeJson<T>(w: StringBuilder, value: T): void

Appends what JSON.stringify(value) writes to w (one function per type, generated).

Re-exported from velt/encoding/json/value

type Value = JsonValue

A JSON value of unknown shape: the prelude's JsonValue (docs/std/encoding/json.md).