Data & JSON

JSON to SQL

Convert a JSON object or array to CREATE TABLE and INSERT statements for MySQL, PostgreSQL or SQLite. Infers column types across all rows and escapes strings safely, locally.

About this tool

Paste a JSON object or an array of objects to generate a CREATE TABLE statement and a multi-row INSERT. MySQL, PostgreSQL and SQLite are supported, with table and column names quoted for the selected dialect.

Column types are inferred across all rows: integers, decimals, booleans and text map to matching SQL types. Missing fields become NULL, and nested objects and arrays are stored as JSON text. Strings are escaped safely for import into a test database.

Best use cases

  • Load JSON API samples into a test database.
  • Draft a table definition from existing JSON data.
  • Generate INSERT seed data for test environments.

How to use it

  1. Paste a JSON object or array, or load the example.
  2. Enter a table name and choose the SQL dialect and output.
  3. Select Convert, review the column types, then copy or download the .sql file.

Scope and limits

  • Up to 200,000 characters, 1,000 rows, 200 columns and 40 nesting levels. Column names differing only by case are not supported.
  • Primary keys, indexes and constraints are not created. Types reflect the current sample only; review them before importing.
  • Numbers beyond the JavaScript safe integer range are rejected. Encode large integers as strings.

Data processing

JSON parsing and SQL generation run in a local browser worker. No database connection is made and data is not uploaded or stored.

Related tools

More in this category