Support json_pretty() function for formatted JSON output
Description:
Currently, StarRocks provides json_format() to serialize JSON values, but it outputs compact one-line strings.
For debugging and readability, it would be useful to support a json_pretty() function that prints JSON with indentation and line breaks, similar to PostgreSQL’s jsonb_pretty or MySQL’s JSON_PRETTY.
Example:
SELECT json_pretty('{"a":1,"b":[1,2,3]}');
Expected Output:
{
"a": 1,
"b": [
1,
2,
3
]
}
I would like to work on this, can you assign me? @murphyatwork
Hi, I would like to work on this if possible. (Working on a university assignment ^_^)
Hi @murphyatwork. Feel free to assign me to this!
Hi @murphyatwork and @ronkapoor86,
I checked the repository but couldn't find an open PR associated with this issue currently.
I also noticed that @daphnecalin appears to have implemented this in their personal fork. @daphnecalin, are you planning to submit a PR to the official repository?
If neither of you are working on this, I would be happy to pick it up and submit the PR.
Hi @murphyatwork,
I have raised the PR #66695 for this feature. It includes the complete implementation (BE & FE), comprehensive tests (Unit & Regression), and documentation.
Please take a look when you have a moment. Thanks!