Encode

array

RES
let array: array<t> => t

Returns an array as JSON.

Examples

RES
let array = [JSON.Encode.string("hello world"), JSON.Encode.int(42)] JSON.Encode.array(array)

bool

RES
let bool: bool => t

Returns a boolean as JSON.

Examples

RES
JSON.Encode.bool(true)

boolArray

RES
let boolArray: array<bool> => t

Returns an array of booleans as a JSON object.

float

RES
let float: float => t

Returns a float as JSON.

Examples

RES
JSON.Encode.float(42.0)

floatArray

RES
let floatArray: array<float> => t

Returns an array of floats as a JSON object.

int

RES
let int: int => t

Returns an int as JSON.

Examples

RES
JSON.Encode.int(42)

intArray

RES
let intArray: array<int> => t

Returns an array of integers as a JSON object.

null

RES
let null: t

Returns null as a JSON value.

Examples

RES
JSON.Encode.null

object

RES
let object: dict<t> => t

Returns a dict as a JSON object.

Examples

RES
let dict = Dict.fromArray([ ("foo", JSON.Encode.string("bar")), ("hello", JSON.Encode.string("world")), ]) JSON.Encode.object(dict)

objectArray

RES
let objectArray: array<dict<t>> => t

Returns an array of objects as a JSON object.

string

RES
let string: string => t

Returns a string as JSON.

Examples

RES
JSON.Encode.string("hello world")

stringArray

RES
let stringArray: array<string> => t

Returns an array of strings as a JSON object.