Schema Inference Tool
Every new integration starts the same way: an API returns a JSON blob and you need a model to hold it. Typing out 20 fields by hand is tedious and error-prone. This tool parses a sample JSON object, picks a column type for each key, and emits a ready-to-paste schema in the flavor you want: SQL CREATE TABLE, Mongoose schema, or Sequelize model definition.
How to infer a schema from JSON
-
1
Paste a sample object
Drop in one JSON object, or an array of objects (the first object in the array is read). Use a complete record with every field filled so each column gets a type.
-
2
Pick the output format
SQL CREATE TABLE (Postgres / MySQL / SQLite flavor), Mongoose for Node.js MongoDB apps, or Sequelize for Node.js relational apps.
-
3
Name the table or model
Sets the table name in the SQL output, or the schema / model name in the Mongoose and Sequelize output.
-
4
Copy the generated schema
Paste it straight into a migration or a model file as a starting point.
How types are inferred
Inference is a best-guess. The tool reads the values of one sample object and picks a column type for each key from the value it sees. It does not compare records or learn which fields are optional, so give it a complete, representative object.
Type mapping
| JSON value | SQL type | Mongoose type | Sequelize type |
|---|---|---|---|
42 (integer) |
INTEGER | Number | DataTypes.INTEGER |
3.14 (decimal) |
DECIMAL(10,2) | Number | DataTypes.FLOAT |
"hello" (short string) |
VARCHAR(255) | String | DataTypes.STRING |
| string longer than 255 chars | TEXT | String | DataTypes.STRING |
"2026-04-18T10:00:00Z" |
TIMESTAMP | Date | DataTypes.DATE |
"2026-04-18" |
DATE | Date | DataTypes.DATEONLY |
true / false |
BOOLEAN | Boolean | DataTypes.BOOLEAN |
null |
TEXT | String | DataTypes.STRING |
[1, 2, 3] (array) |
JSON | Object | DataTypes.JSON |
{ "nested": ... } (object) |
JSON | Object | DataTypes.JSON |
What the SQL output adds
The SQL CREATE TABLE always starts with an auto-increment primary key:
id INTEGER PRIMARY KEY AUTOINCREMENT,
The Mongoose and Sequelize output do not add an id field, because both libraries create one for you.
Defaults and limits to keep in mind
- One object is read. If you paste an array, only the first element is inspected, so its fields define the whole schema.
- A missing key is an absent column. Fields that are not present in the sample object simply do not appear in the output.
- Nested objects and arrays become a single JSON column. The tool does not expand them into sub-tables, sub-schemas or foreign keys.
- No constraints are generated. Columns are emitted without
NOT NULL, unique or index clauses, so all of them are nullable until you tighten them.
Tips for a cleaner result
- Use a fully populated record. A field that is
nullin your sample is typed as text/string, which is rarely what you want. - Rename reserved words after generation. Fields like
type,orderoruserwill need quoting in SQL. - Treat the output as a scaffold. Tighten VARCHAR lengths and DECIMAL precision, add indexes, mark columns
NOT NULL, and pick real keys before shipping.
Frequently Asked Questions
A nested object or an array is mapped to a single JSON column (JSON in SQL and Sequelize, an Object field in Mongoose). The tool does not expand nested structures into sub-tables or sub-schemas, so you flatten or normalise them yourself if you need to.
No. If you paste an array of objects, only the first object is inspected and its keys define the schema. Make sure that first record has every field you care about, with a real value in each one.
No. Every column is emitted with just a type, so the output has no foreign keys, unique constraints, indexes or NOT NULL clauses. Add those by hand, because they encode intent the tool cannot recover from a sample.
Pick SQL CREATE TABLE for a relational database migration, Mongoose Schema for a Node.js app on MongoDB, or Sequelize Model for a Node.js app on a relational database through the Sequelize ORM.
Related Tools
ASCII Table Reference
Full ASCII table from 0 to 127 with decimal, hex, octal, binary, standard names and HTML numeric-reference notation, including NUL, LF and DEL.
Color Palette Generator
Generate monochromatic, analogous, complementary, triadic or tetradic color palettes from a base HEX color and export copy-ready CSS variables.
FPS Counter
Measure browser FPS with requestAnimationFrame, smoothing, min/max frame rate, warnings and an optional graph. Runs locally with no upload or API.
HTML Character Reference
Searchable list of HTML entities, their named and numeric codes, and a one-click copy for special characters and symbols.
HEX Color Picker
Pick or enter a HEX colour and get RGB, HSL, approximate CMYK, relative luminance and contrast ratios against white and black.
Keyboard Shortcut Reference
Search documented default keyboard shortcuts for VS Code, Chrome and Bash with GNU Readline on macOS, Windows and Linux.
Tool available in other languages
- Herramienta de Inferencia de Esquema [ES]
- Outil d'inférence de schéma [FR]
- Alat Inferensi Skema [ID]
- Schemainferensverktyg [SV]
- أداة استنتاج المخطط [AR]
- スキーマ推論ツール [JA]
- 스키마 추론 도구 [KO]
- Narzędzie do wnioskowania schematu [PL]
- Schema-inferentie-tool [NL]
- Công cụ suy luận lược đồ [VI]
- เครื่องมืออนุมาน Schema [TH]
- Ferramenta de Inferência de Esquema [PT]
- Schema-Inferenz-Tool [DE]
- Инструмент вывода схемы [RU]
- Şema Çıkarım Aracı [TR]
- 模式推断工具 [ZH]
- Strumento di Inferenza Schema [IT]