JSON Functions
- reference
This topic describes the builtin SQL++ for Enterprise Analytics JSON functions.
decode_json
-
Syntax:
decode_json(expr)
-
Unmarshals the JSON-encoded string into a SQL++ for Enterprise Analytics value.
-
Arguments:
-
expr: a JSON-encoded string.
-
-
Return Value:
-
A SQL++ value.
-
If
expris NULL or an empty string then NULL is returned. -
If
expris MISSING then MISSING is returned.
-
-
Example:
decode_json("{\"abc\":1,\"def\":2}"); -
The expected result is:
{ "abc": 1, "def": 2 }
encode_json
-
Syntax:
encode_json(expr)
-
Marshals the SQL++ for Enterprise Analytics value into a JSON-encoded string.
-
Arguments:
-
expr: a SQL++ value.
-
-
Return Value:
-
A JSON-encoded string.
-
If
expris NULL then NULL is returned. -
If
expris MISSING then MISSING is returned.
-
-
Example:
encode_json({"abc":1,"def":2}); -
The expected result is:
"{ \"abc\": 1, \"def\": 2 }"
encoded_size
-
Syntax:
encoded_size(expr)
-
Returns the number of bytes in an uncompressed JSON encoding of the value. The exact size is implementation-dependent.
-
Arguments:
-
expr: a SQL++ value.
-
-
Return Value:
-
An integer. Never MISSING or NULL. Returns 0 for MISSING.
-
-
Example:
encoded_size({"abc":1,"def":2}); -
The expected result is:
22