EncodeJSON (open)

Encode data as a JSON string

Syntax

// Core function, no LOADLIB necessary

STRING FUNCTION EncodeJSON(VARIANT arg, RECORD translations, RECORD options)

Parameters

VARIANT arg

Data to encode

RECORD translations

Translations to specify literal cellnames, eg [ somecamelcaps : = "someCamelCaps" ] if you want to literally spell the cells that way

RECORD options

Options

formatted

Format the JSON nicely (with newlines and indents)

Return value

STRING

The encoded string. Throws if any type could not be converted

Description

Arrays, Integers, strings and booleans are directly converted to their Javascript counterparts. Records are converted to objects, with all cellnames converted to lowercase.