Cast JSON to varchar with Trino
Use json_format
/json_parse
to handle json object conversions instead of casting:
select json_parse('{"property": 1}') objstring_to_json, json_format(json '{"property": 2}') jsonobj_to_string
Output:
objstring_to_json | jsonobj_to_string |
---|---|
{"property":1} | {"property":2} |