Skip to main content
DuckDB’s JSON scalar functions, exposed as free functions in better_duck_diesel::dsl::*.

Functions

json_extract_string returns Nullable<Text> — a missing path yields NULL, so load it into an Option<String>.

The json feature

JSON functions rely on DuckDB’s JSON extension, which DuckDB normally autoloads on first use. Enabling this crate’s json feature instead bundles the extension into the embedded library (it forwards to core’s json), so the functions work offline with no runtime autoload or INSTALL/LOAD step — useful in sandboxed or air-gapped environments.
If you have disabled autoload and not enabled the feature, load the extension explicitly on the core connection: conn.inner_mut().load_extension("json")? — or, in a pool, from the on_connect hook.

JSON aggregates

json_group_array and json_group_object aggregate rows into a JSON array/object. They live on the Aggregates page.

See also

Aggregates

json_group_array / json_group_object.

List & map functions

Native LIST/MAP as an alternative to JSON.

Feature flags

What the json feature bundles.

DSL overview

The rest of the DSL.