Skip to content

Add support for SQLite JSONB #4101

@max-kamps

Description

@max-kamps

I have found these related issues/pull requests

Description

SQLite's built-in json extension, in addition to supporting JSON and JSON5 data stored in TEXT values, also supports a custom JSONB format stored in BLOB values.

Currently it's possible to access JSONB values by first letting SQLite convert them back into JSON text, and then using the standard types::Json wrapper to deserialize them. It would be nice if it was possible to directly deserialize the JSONB BLOB values without the conversion step.

Prefered solution

A serde-sqlite-jsonb deserializer crate already exists, though I haven't looked at the code quality. It would be possible to create a Jsonb wrapper type that behaves similarly to the currently existing Json type

Alternatively, it would be even nicer if the existing wrapper type automatically detected JSONB instead of JSON when fed the appropriate SqliteValue (the rules for this detection are explained in the SQLite docs), but that might not be possible with the current design.

Is this a breaking change? Why or why not?

Neither solution would be a breaking change. The SQLite JSONB docs explain how the json extension operates on both data formats in a backwards-compatible way.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions