Auto-decode columns declared as JSON in output modes (issue #579)

Columns declared with type JSON now decode automatically wherever nested
JSON is already supported (query/rows/search/memory output, and the
Python API), without needing --json-cols. Uses sqlite3's built-in
detect_types=PARSE_DECLTYPES + a registered JSON converter, so it works
transparently through joins and aliases. Flat formats (CSV/TSV/table/raw)
re-serialize decoded values back to JSON text instead of a Python repr.
Also adds "JSON" as a first-class column type for create()/add_column()/
transform(), and fixes column_affinity("JSON") so transform() doesn't
rewrite JSON columns as REAL.
This commit is contained in:
Parker Gurney 2026-08-05 14:18:25 -07:00
commit f34dfb25da
8 changed files with 99 additions and 10 deletions

View file

@ -375,6 +375,12 @@ def test_create_error_if_invalid_self_referential_foreign_keys(fresh_db):
'CREATE TABLE "dogs" (\n "name" TEXT\n, "float" FLOAT)',
),
("blob", "blob", None, 'CREATE TABLE "dogs" (\n "name" TEXT\n, "blob" BLOB)'),
(
"friends",
"JSON",
None,
'CREATE TABLE "dogs" (\n "name" TEXT\n, "friends" JSON)',
),
(
"default_str",
None,