SyntaxStudy
Sign Up
MySQL Beginner 3 min read

JSON Column Type

JSON Column Type

MySQL 5.7+ supports a native JSON column type that validates and stores JSON efficiently. Unlike TEXT, JSON columns are indexed and queryable.

Example
CREATE TABLE products (
  id INT AUTO_INCREMENT PRIMARY KEY,
  name VARCHAR(255),
  attributes JSON
);

INSERT INTO products (name, attributes)
VALUES ('Laptop', '{"color": "black", "ram": 16, "ssd": true}');
Pro Tip

JSON columns reject invalid JSON at insert time — no need for application-level validation.