---
title: "JSON to SQL"
description: "Paste a JSON array of objects and get CREATE TABLE plus INSERT statements for PostgreSQL, MySQL or SQLite. Booleans stay booleans, null becomes NULL, nested objects become JSON text. Runs in your browser."
url: https://findutils.com/convert/json-to-sql/
category: convert
---

# JSON to SQL

Paste a JSON array of objects and get CREATE TABLE plus INSERT statements for PostgreSQL, MySQL or SQLite. Booleans stay booleans, null becomes NULL, nested objects become JSON text. Runs in your browser.

**Use this tool:** [JSON to SQL](https://findutils.com/convert/json-to-sql/)

## Programmatic access

- REST id `json-to-sql`: POST https://api.findutils.com/api/tools/json-to-sql/execute (reference: https://findutils.com/api/json-to-sql/)
- MCP tool `json_to_sql` on https://mcp.findutils.com (reference: https://findutils.com/mcp/json-to-sql/)

## Why Use Our JSON to SQL Converter?

You have an API response or a test fixture and you want it in a table. The two usual routes both cost something. Typing the INSERT statements by hand is slow and gets slower with every column. Bouncing the JSON through CSV first is quicker but lossy: true becomes the text "true", null becomes the text "null", and a nested object becomes the string [object Object]. This page reads the JSON values directly, so a boolean stays a boolean, a missing key becomes NULL, and a nested object is stored as its JSON text.

## Frequently Asked Questions

### Does my JSON get uploaded anywhere?

No. The JSON is parsed in your browser and the SQL is generated there. Nothing is sent to a server.

### How are column types decided?

From the real JSON values, across every row. A whole-number column is an integer, a decimal widens it to numeric, true and false give a boolean, and anything else is text. A null or a missing key is ignored while deciding, so it can never narrow a column.

### What happens to a nested object or an array?

It is stored as its JSON text in one column — never the string [object Object], which is what you get from routing the data through CSV. Splitting nested data into related tables is schema design, so the tool leaves that to you.

### How is null handled?

A null value and a key missing from that row both become NULL. SQL has no way to distinguish the two, so neither does the output.

### Which SQL dialects are supported?

PostgreSQL, MySQL and SQLite. The dialect changes identifier quoting, the type names in the CREATE TABLE, and how booleans are written — SQLite has no boolean literal, so it gets 1 and 0.

### What if my rows have different keys?

The columns are the union of every key, in the order they are first seen. A row that lacks one of them gets NULL for that column, so nothing is clipped.

### Can I paste a single object instead of an array?

Yes. A single object is treated as a one-row array. NDJSON — one JSON object per line — is also accepted, and is tried automatically if the whole paste is not valid JSON on its own.

### What is the difference between one INSERT per row and multi-row INSERTs?

One statement per row is easier to read and easier to run partially. Multi-row INSERTs are considerably faster to execute on a large array. They are chunked at 500 rows so no single statement becomes unmanageable.

### Does it create indexes, keys or constraints?

No. The CREATE TABLE names the columns and their types and nothing else. Primary keys, foreign keys and indexes depend on how you intend to query the data, which the JSON does not say.

### Can I use this from a script or an AI client?

Yes. The same generator is available over HTTP and to MCP clients, so an agent can produce the SQL without opening this page. The reference pages for both surfaces are linked from the tool.

## Related Tools

- [CSV to SQL](https://findutils.com/convert/csv-to-sql/)
- [SQL to CSV](https://findutils.com/convert/sql-to-csv/)
- [JSON to CSV](https://findutils.com/convert/json-to-csv/)
- [SQL Formatter](https://findutils.com/developers/sql-formatter/)
- [JSON Formatter](https://findutils.com/developers/json-formatter/)
- [JSON to XML](https://findutils.com/convert/json-to-xml/)
- [SQLite Browser](https://findutils.com/developers/sqlite-browser/)
- [JSON Path Finder](https://findutils.com/developers/json-path-finder/)
- [NDJSON to CSV](https://findutils.com/convert/ndjson-to-csv/)
- [CSV to NDJSON](https://findutils.com/convert/csv-to-ndjson/)
