JSON to SQL Converter

Paste JSON and generate SQL CREATE TABLE & INSERT INTO statements

JSON Input
SQL Output

SQL output will appear here.
Press Ctrl+Enter or click Generate SQL.

About JSON to SQL Converter

The JSON to SQL Converter transforms JSON data into SQL CREATE TABLE statements with properly inferred column types. It supports MySQL, PostgreSQL, SQLite, and SQL Server dialects. Optionally generate INSERT statements to populate the table with your JSON data.

Key Features

  • Multi-dialect support — generates valid SQL for MySQL, PostgreSQL, SQLite, and SQL Server.
  • Type inference — automatically maps JSON types to appropriate SQL column types.
  • Primary key generation — optionally add an auto-increment primary key column.
  • INSERT generation — generate INSERT statements from array data to populate your table.
  • Nested flattening — nested JSON objects are flattened into columns using underscore naming.

How to Use

  1. Input JSON — paste a JSON object or array of objects into the editor.
  2. Configure — set table name, SQL dialect, and toggle options.
  3. Generate — click Generate SQL or press Ctrl+Enter.
  4. Export — copy to clipboard or download as a .sql file.

Frequently Asked Questions

How are JSON types mapped to SQL?

Strings map to VARCHAR/TEXT, numbers to INT/DECIMAL, booleans to BOOLEAN/BIT, null to nullable columns, and nested objects are flattened.

Can I use a JSON array?

Yes. A JSON array of objects is the ideal input. All objects are merged to determine the full column set, and INSERT statements can be generated for each row.

© glutool. v1.0
Powered with by RL
Code snippet