JSON Encode | ENCODE_JSON

Syntax

ENCODE_JSON( [value] )

Parameters

value
A value to encode.

Return Value

A JSON encoded TEXT value.

Description

Encode a value as JSON.

Examples

ENCODE_JSON("some text") # returns "\"some text\""
ENCODE_JSON(null) # returns "null"
ENCODE_JSON([1, 2, 3]) # returns "[1, 2, 3]"
ENCODE_JSON(["a" => 1, "b" => 2]) # returns "{\"a\": 1, \"b\": 2}"