JSON Type
This page is part of MariaDB's MariaDB Documentation.
The parent of this page is: Data Types for MariaDB Xpand
Topics on this page:
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.
See also: Data Types for MariaDB Xpand 6.1, in 6.0, and in 5.3
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 |
|
6.0 |
|
5.3 |
|