JSON_FORMAT

All functions > JSON > JSON_FORMAT

Returns the given JSON expression as a string.

Signatures

Returns: A VARCHAR representation of the JSON value

JSON_FORMAT(expr: JSON) → VARCHAR
sql
ParameterTypeRequiredDescription
exprJSONYesThe JSON expression to convert to string

Notes

  • Converts JSON values to their string representation
  • Preserves JSON structure in the string output
  • Objects are formatted as JSON object strings
  • Arrays are formatted as JSON array strings
  • Primitives are converted to their string representation
  • Useful for storing or transmitting JSON as text
  • Inverse of JSON_PARSE
  • Output is valid JSON format

Examples

FeatureQL
SELECT
    f1 := JSON_FORMAT(JSON_PARSE('{"name": "Alice", "age": 30}')),  -- Convert JSON object to string
    f2 := JSON_FORMAT(JSON_PARSE('[1, 2, 3]')),  -- Convert JSON array to string
    f3 := JSON_FORMAT(JSON_PARSE('"hello"'))  -- Convert JSON string to string
;
Result
f1 VARCHARf2 VARCHARf3 VARCHAR
{"name": "Alice", "age": 30}[1, 2, 3]"hello"

Last update at: 2026/03/03 16:47:38
Last updated: 2026-03-03 16:48:19