Skip to content
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

json result helpers #114

Merged
merged 1 commit into from
Jan 19, 2025
Merged

json result helpers #114

merged 1 commit into from
Jan 19, 2025

Conversation

jraymakers
Copy link
Contributor

@jraymakers jraymakers commented Jan 19, 2025

Add several new helpers for getting result data as JSON-serializable values.

Both DuckDBResult and DuckDBResultReader now have getColumnsJson, getColumnsObjectJson, getRowsJson, and getRowObjectsJson.

The conversion to JSON-serializable values is non-lossy. DuckDB data values that cannot be expressed in JSON are usually converted to a string; in a few cases (e.g. INTERVAL, MAP, UNION) they're converted to an object or array.

This is implemented using a general-purpose value conversion mechanism, which is exposed on DuckDBDataChunk. Other conversions can be implemented using this mechanism.

@jraymakers jraymakers merged commit 73edd12 into main Jan 19, 2025
5 checks passed
@jraymakers jraymakers deleted the jray/json-result-helpers branch January 19, 2025 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant