How to use JSON to SQL
- Paste a JSON array of objects.
- Enter the table name, dialect and primary key.
- Copy the SQL output.
JSON to SQL features
- Converts arrays of objects (API responses, fixtures) into INSERT statements
- Optional CREATE TABLE with inferred types
- Flattens nested objects into parent_child columns; arrays stored as JSON
- Union of keys across objects — missing fields become NULL
- Five dialects with correct boolean, date and JSON types
- Batching and single-statement-per-row modes
JSON to SQL example
Seed from an API payload
Input:
[{"id": 1, "name": "Layla", "profile": {"city": "Riyadh"}}]Output:
CREATE TABLE IF NOT EXISTS users (
id INT NOT NULL,
name VARCHAR(10) NOT NULL,
profile_city VARCHAR(10) NOT NULL,
PRIMARY KEY (id)
);
INSERT INTO users (id, name, profile_city) VALUES
(1, 'Layla', 'Riyadh');Frequently asked questions about JSON to SQL
What JSON shape is expected?
An array of objects with consistent keys, such as an API response. An object wrapping the array (e.g. {"data": [...]}) is also detected.
How are nested objects and arrays handled?
Nested objects are flattened into columns named parent_child. Arrays are stored as JSON text (JSONB in PostgreSQL, JSON in MySQL). Untick "Flatten" to store whole objects as JSON instead.
What if objects have different keys?
The column set is the union of all keys in first-seen order; missing fields become NULL.
Do dates keep their type?
ISO 8601 strings are detected and typed as DATE or TIMESTAMP; other strings remain VARCHAR.