MariaDB JSON vs MySQL JSON: Not the Same Type

Why a JSON column that is a genuine binary type in MySQL is really just a LONGTEXT column with a validation constraint in MariaDB.

MySQL (any) → MariaDB (any)

Quick answer

MySQL's JSON is a real binary storage type with its own internal representation. MariaDB's JSON is purely an alias for LONGTEXT with an automatically added CHECK (JSON_VALID(col)) constraint — the data is stored and read back as plain text, not a binary JSON format.

Why it matters

Code that assumes MySQL's JSON storage/validation semantics (e.g. relying on the binary format's automatic key ordering behavior, or storage-size characteristics) will behave differently on MariaDB, even though CREATE TABLE ... JSON syntax is accepted by both. The validation behavior (rejecting invalid JSON) is preserved via the CHECK constraint, but the storage mechanics are not the same.

What to do about it

Migration steps

  • Don't rely on JSON column storage size or internal key ordering being identical between MySQL and MariaDB.
  • If migrating a MySQL schema to MariaDB, confirm the JSON_* functions your application uses are all supported by the MariaDB version you're targeting — MariaDB's JSON function set has grown over time but was historically smaller.
  • If migrating from MariaDB to MySQL, the reverse is safe: MySQL's native JSON type is a strict superset of "validated JSON text", so existing data imports cleanly.

References

  • MySQL 8.0 Reference Manual — The JSON Data Type (v8.0) — checked 2026-07-31
  • MariaDB Knowledge Base — JSON Data Type — checked 2026-07-31

Last verified 2026-07-31.