Skip to content

Show JSONB blobs as JSON in the Edit Cell dock - #4227

Open
deepsidhu1313 wants to merge 4 commits into
sqlitebrowser:masterfrom
deepsidhu1313:feature/jsonb-view
Open

deepsidhu1313 wants to merge 4 commits into
sqlitebrowser:masterfrom
deepsidhu1313:feature/jsonb-view

Conversation

@deepsidhu1313

Copy link
Copy Markdown
Contributor

Blobs that are SQLite JSONB arrays or objects (SQLite 3.45 and newer) are now shown as read-only JSON text when the Edit Cell dock is in one of the text or JSON modes, instead of the "Binary data can't be viewed in this mode" message. The data type stays Binary, so editing, applying and exporting work as before, and the info label reads "Binary (JSONB)".

The conversion is done by SQLite itself (json() on a :memory: handle). Only containers whose header size matches the blob length are detected, because most other short blobs are valid JSONB as well.

Add a test-jsonb target for the detection and conversion.

Closes #3578

Blobs that are SQLite JSONB arrays or objects (SQLite 3.45 and newer) are
now shown as read-only JSON text when the Edit Cell dock is in one of the
text or JSON modes, instead of the "Binary data can't be viewed in this
mode" message. The data type stays Binary, so editing, applying and
exporting work as before, and the info label reads "Binary (JSONB)".

The conversion is done by SQLite itself (json() on a :memory: handle).
Only containers whose header size matches the blob length are detected,
because most other short blobs are valid JSONB as well.

Add a test-jsonb target for the detection and conversion.

Closes sqlitebrowser#3578

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Add a test-edit-dialog target that loads JSONB, binary and text data
into the dialog without a display and checks that JSONB is shown as
read-only JSON, that the editor is writable again for the next text
value, and that other binary data still shows the usual message.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
test-global-filter needs the CMake prefix paths on PATH on Windows
because the CI jobs build SQLite as a DLL there. test-jsonb and
test-edit-dialog link SQLite too and crashed on Windows without them.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The .ui files connect to slots that don't exist in Qt6 (QDialog::help)
unless uic generates string based connections. The main target already
sets this option for Qt6, but test-edit-dialog compiles the dialogs'
.ui files as well and failed to build in the Windows on ARM job.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

[Feature]: Visualize JSONB as JSON

2 participants