PostgreSQL → MySQL
Convert PostgreSQL jsonb to MySQL JSON
MySQL's JSON type stores documents in an optimized binary format, much like jsonb — so documents move across losslessly and stay queryable.
jsonb → JSON
What to know
- jsonb and json both → MySQL JSON
- doc->>'key' becomes JSON_UNQUOTE(JSON_EXTRACT(doc,'$.key')) or the ->> operator (8.0+)
- GIN indexes have no direct equivalent — index generated columns instead
- Key order is normalized in both engines; duplicates keep the last value
Before / after
PostgreSQL
SELECT settings->>'theme' FROM accounts; MySQL
SELECT settings->>'$.theme' FROM accounts;
-- index: ALTER TABLE accounts ADD COLUMN theme VARCHAR(32)
-- GENERATED ALWAYS AS (settings->>'$.theme'), ADD KEY (theme); Don't convert column-by-column — convert the whole database.
Upload a dump, get back ready-to-import SQL with this mapping (and every other one) applied.
Open the PostgreSQL → MySQL converterSee the full type mapping table or all guides.