JSON Type

Overview

A native JSON data type that converts the assigned value into an internal JSON representation.

If an assigned value has a syntax error, it is rejected with an error.

If a dictionary value is specified with a duplicate key, the first value is the only one retained in the internal representation.

EXAMPLES

CREATE TABLE json_example (
  description VARCHAR(20),
  example JSON
);
INSERT INTO json_example VALUES
  ('Array', '[ 1, 2, 3 ]'),
  ('Dictionary', '{ "a": 1, "b": 2 }'),
  ('Unduplicated', '{ "a":1,"b":2, "a":3,"b": 4,"b":5}');
SELECT * FROM json_example;
+--------------+------------------+
| description  | example          |
+--------------+------------------+
| Array        | [1, 2, 3]        |
| Dictionary   | {"a": 1, "b": 2} |
| Unduplicated | {"a": 1, "b": 2} |
+--------------+------------------+
INSERT INTO json_example VALUES
  ('Invalid', '{');
ERROR 3140 (HY000): [1071] Invalid JSON: "parse error: premature EOF
                                           {
                                        ^
"

CHANGE HISTORY

Release Series

History

6.1

  • Present starting in MariaDB Xpand 6.1.0.

6.0

  • Present starting in MariaDB Xpand 6.0.3.

5.3

  • Present starting in MariaDB Xpand 5.3.13.

Release Series

History

6.0

  • Present starting in MariaDB Xpand 6.0.3.

5.3

  • Present starting in MariaDB Xpand 5.3.13.