New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add duckdb::JsonValue
#11868
Add duckdb::JsonValue
#11868
Conversation
I'm not sure I agree with this statement, they are starting to outgrow the current architecture of the script however. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! Looks great - some minor comments:
This PR adds a new
JsonValue
class to represent/parse/print json objects.JSON is everywhere, and its pretty useful to be able to have a small json utility built into DuckDB when working with extensions or other tooling, even if its not used in the query engine itself, or as efficient as the implementation in the dedicated JSON extension.
Right now this only replaces the
ToJSONMap()
function and co used when stringifying exceptions in theErrorData
, but I have some plans and ideas to use it in:json_serialize_sql()
,json_parse_serialized_sql()
andJsonSerializer
functions into core. This would allow use to tighten up the serializer infrastructure a bit if we can assume that extensions won't push their own serializers.The parser does not handle unicode escape characters, but should otherwise be JSON compliant. We can make it more sophisticated in the future.