JSON to SQL CREATE TABLE and DDL Generator

Convert a JSON sample into draft CREATE TABLE DDL for PostgreSQL, MySQL, SQLite, SQL Server, or Oracle.

// about

About this Tool

This tool infers columns and SQL types from a JSON object and creates a starting DDL statement. Nested values are represented as JSON or text and the generated script must be reviewed before production use.

How to use it

  1. Paste a representative JSON object into the input box.
  2. Select a database and enter the table name.
  3. Click Generate, then review types, constraints, indexes, and relationships before running the DDL.

Why people use this tool

  • Turn a JSON sample into a draft SQL table definition quickly.
  • Choose PostgreSQL, MySQL, SQLite, SQL Server, or Oracle syntax.
  • Use the result as a starting point for reviewing columns and data types.

Frequently Asked Questions

Does the tool design a complete database schema?

No. It creates a draft table from one JSON sample. Add keys, constraints, indexes, relationships, and migrations for your application.

Guides · Data · 6 min read

UUID Guide: v4 vs v7 and Using UUIDs as Database Primary Keys

Strings like 550e8400-e29b-41d4-a716-446655440000 identify orders, files and API requests everywhere. Learn how UUIDs are generated and which version to choose.

A UUID (Universally Unique Identifier) is a 128-bit identifier that lets anyone create IDs that will not clash, without asking a central server. Microsoft calls it a GUID. The current standard is RFC 9562, published in 2024.

UUID structure, how versions differ, why collisions are practically impossible, and why UUID v7 is overtaking v4 for database primary keys.
Read guide →
Build it with AI

Build this tool yourself with AI

Want your own version of this tool? Copy the work-order prompt into an AI chat, or save the skill file for an AI coding agent. Both describe the features, edge cases and test cases we used when building it.

AI work-order prompt

Paste it as-is into an AI chat such as Claude, ChatGPT or Gemini.

You are an experienced full-stack web developer. Build a web tool called "JSON to DDL Generator" that meets the requirements below.

## Goal

Build a tool that generates database CREATE TABLE statements from a JSON sample.

## Core features

- Choose MySQL, PostgreSQL, SQL Server or Oracle
- Infer column types from values
- Choose a primary key
- Option to map nested objects and arrays to child tables or JSON columns
- Copy result

## Inputs

- A JSON object or array of objects
- Database, table name, primary key

## Outputs

- CREATE TABLE SQL
- Reason for each inferred type

## Edge cases and handling rules

- Pick the widest type across rows (int + decimal → DECIMAL)
- Infer date/time types from ISO 8601 strings
- Allow NULL where null values appear
- Respect each database's identifier quoting and reserved words

## Implementation requirements

- Build it as a single page (HTML, CSS, JavaScript) that runs entirely in the browser, and never send the user's input to a server.
- Make the UI responsive and easy to use on mobile; label every input and keep everything keyboard accessible.
- Add a Copy button for results and show clear, friendly error messages for invalid input.
- Keep the core logic in functions separate from the UI so it can be unit-tested.

## Definition of done (test cases)

- {"id":1,"price":9.9,"createdAt":"2026-10-28T09:00:00Z"} gives integer, decimal and timestamp types
- PostgreSQL output uses double-quoted identifiers
- PRIMARY KEY appears when a key is chosen

First outline your implementation plan in at most five lines, then write the complete code, and finally explain how to check the test cases above.

Skill (SKILL.md)

Save it as .claude/skills/build-json-ddl-generator/SKILL.md for AI coding agents such as Claude Code to reuse whenever you build or change this tool.

---
name: build-json-ddl-generator
description: Use when building or changing a JSON to DDL Generator tool. Build a tool that generates database CREATE TABLE statements from a JSON sample.
---

# Build: JSON to DDL Generator

## Goal

Build a tool that generates database CREATE TABLE statements from a JSON sample.

## Workflow

1. Review the required features, inputs and outputs below and ask about anything missing first.
2. Implement the core logic as pure functions separate from the UI.
3. Check the logic against the test cases in the verification list.
4. Build a responsive UI with an input form, a result area and a Copy button.
5. Reproduce each edge case listed under Rules and refine the error messages.

## Core features

- Choose MySQL, PostgreSQL, SQL Server or Oracle
- Infer column types from values
- Choose a primary key
- Option to map nested objects and arrays to child tables or JSON columns
- Copy result

## Inputs

- A JSON object or array of objects
- Database, table name, primary key

## Outputs

- CREATE TABLE SQL
- Reason for each inferred type

## Rules

- Pick the widest type across rows (int + decimal → DECIMAL)
- Infer date/time types from ISO 8601 strings
- Allow NULL where null values appear
- Respect each database's identifier quoting and reserved words
- Build it as a single page (HTML, CSS, JavaScript) that runs entirely in the browser, and never send the user's input to a server.

## Verification

- [ ] {"id":1,"price":9.9,"createdAt":"2026-10-28T09:00:00Z"} gives integer, decimal and timestamp types
- [ ] PostgreSQL output uses double-quoted identifiers
- [ ] PRIMARY KEY appears when a key is chosen

Tips for working with AI

  • Tell the AI your stack (for example React, Vue or plain HTML) on the first line so the code matches your project.
  • Ask it to run the listed test cases and show the results before you accept the code.
  • Never paste real secrets, customer data or API keys into the prompt; use sample values instead.