JSON Toolkit

Fast, private JSON tools that run in your browser.

πŸ”’ Data stays in your browser

SQL Query Generator

Turn JSON into SQL for PostgreSQL, MySQL, SQLite or SQL Server. Create a table with inferred column types, insert or upsert rows, or build SELECT queries with joins, grouping and pagination. Every value is escaped safely, and nothing is executed.

SQL Query Generator

Turn JSON into SQL statements for your database. Statements are generated as text in your browser and are never run. CREATE TABLE guesses column types from your data, so review them before use.

How to use the SQL Query Generator

  1. Enter the table name, then choose your database and the statement you need.
  2. Paste your rows as JSON, or fill in the columns, filter and other options.
  3. Click Generate SQL, then copy it or download it as a .sql file.

Features

  • PostgreSQL, MySQL/MariaDB, SQLite and SQL Server
  • CREATE TABLE with column types, NOT NULL and primary keys inferred from your data
  • INSERT and upsert, split into batches of 1,000 rows
  • SELECT with JOIN, GROUP BY, HAVING, DISTINCT, ORDER BY, LIMIT and OFFSET
  • Filters written as JSON, such as {"age": {"$gte": 18}}
  • Test the statement on sample rows with SQLite running in your browser
  • Ready-to-use Node.js and Python code with parameterized queries for each database's standard driver
  • A plain-English explanation, plus suggested indexes for filters, sorting and joins
  • Every value escaped and every name quoted when needed

Frequently asked questions

Which databases are supported?
PostgreSQL, MySQL and MariaDB, SQLite and SQL Server. Quoting, true/false values, LIMIT versus TOP, upserts and column types follow the database you choose.
How are column types chosen?
From the values in your rows: whole numbers become INTEGER or BIGINT, decimals become floating point, and ISO dates, timestamps, booleans and nested JSON get matching types. Review the types before using the table in production.
Can I check the SQL before running it on my database?
Yes. Paste a few sample rows under Test on sample data and the statement runs in SQLite inside your browser, showing the rows it returns or changes. Nothing is sent to a server.
Is the generated SQL safe from injection?
Values from your JSON are always escaped, names are quoted when needed, and the Columns field accepts only column names and COUNT, SUM, AVG, MIN or MAX, never raw SQL.

Related tools