ENCODE_JSON

Convert JSON input to text

Description

Converts a given JSON-format input (number, true/false, list, object) into a text.

Function signature

ENCODE_JSON(value: String|Number|Boolean|Object|Array, spaces: Number) => String

Parameter

Description

Value

Value to convert

Spaces

A Number that's used to insert white space into the output JSON text for readability purposes

Examples

Formula

Return value

ENCODE_JSON("foobar")

"foobar"

ENCODE_JSON([1, 2, null, "123", true])

[1,2,null,"123",true]

ENCODE_JSON({a: 1, b: null, c: "123", d: true})

{"a":1,"b":null,"c":"123","d":true}

ENCODE_JSON([1, 2, null, "123", true], 2)

[\n 1,\n 2,\n null,\n "123",\n true\n]

ENCODE_JSON({a: 1, b: null, c: "123", d: true}, 2)

{\n "a": 1,\n "b": null,\n "c": "123",\n "d": true\n}