More games at WuGames.ioSponsoredDiscover free browser games — play instantly, no download, no sign-up.Play

Schema Extractor

Generate TypeScript, JSON Schema, Go, Python, Java and C# types from a JSON or CSV API response. Detects enums, optional and nullable fields. Free, private.

clearClearpastePaste

About Schema Extractor

Schema Extractor is a free online tool for automatically generating type definitions and schemas from your JSON or CSV data. Convert data into TypeScript interfaces, JSON Schema, Go structs, Python classes, Java classes, or C# classes—perfect for developers who need to quickly create type definitions from API responses or datasets.

What output formats are supported?

Schema Extractor supports 6 popular output formats:

1. TypeScript Interface - For TypeScript/JavaScript projects
2. JSON Schema - Standard schema definition format
3. Go Struct - For Go (Golang) applications
4. Python Class - For Python projects (with type hints)
5. Java Class - For Java applications
6. C# Class - For C# and .NET projects

Each format is automatically generated with proper types, optional fields, and nested structures based on your input data.

How does it detect field types?

The tool analyzes your data and intelligently detects:

- Basic types: string, number (integer vs float), boolean, null
- Arrays and their element types
- Nested objects and their structures
- Date/time formats (ISO 8601)
- Optional vs required fields (when analyzing multiple records)
- Enums: when a string or number field across your records uses only a small, repeated, closed set of values (e.g. status, role, currency), it is emitted as a TypeScript literal union, a JSON Schema enum, or a Python Literal[...]. Enable 'Detect enums' to use this; fields with all-unique values (like IDs) are left as plain types.

The more representative your sample data, the more accurate the generated schema.

Which JSON Schema draft is generated?

Generated schemas declare draft-07 ($schema: http://json-schema.org/draft-07/schema#) and validate cleanly in standards-compliant validators such as ajv. Integers are emitted as "integer" (not "number") to preserve precision, ISO 8601 dates become {"type":"string","format":"date-time"}, fields of unknown type omit the type keyword instead of using an invalid one, and detected enums add an "enum" array. Required fields are listed under "required".

How are optional vs nullable fields handled?

They are two different things and are emitted separately. Optional means the key is sometimes absent (it appears in some records but not all) — TypeScript marks it with ?, Go/C# use a pointer/nullable type, Python wraps it in Optional[...], and JSON Schema leaves it out of "required". Nullable means the key is present but its value can be null — this adds | null in TypeScript and "null" to the JSON Schema type list. A field can be both optional and nullable. 'Detect optional fields' only triggers when you provide multiple records to compare.

Schema Extractor — Generate TypeScript, JSON Schema, Go, Python, Java and C# types from a JSON or CSV API response. Detects enums, optional
Schema Extractor

Can I use CSV as input?

Yes! When using CSV input:

1. The first row must contain column headers
2. The tool analyzes data types from the values
3. Numbers are detected as numeric types
4. Booleans (true/false) are detected
5. All other values default to strings

For complex nested structures, JSON input provides more accurate results. CSV is best for flat data structures like database tables.

What is the Type/Class Name field?

The Type/Class Name is the identifier used for your generated type definition:

- TypeScript: interface [Name] { ... }
- JSON Schema: { "title": "[Name]", ... }
- Go: type [Name] struct { ... }
- Python: class [Name]: ...

Choose a meaningful name that describes your data (e.g., "User", "Product", "ApiResponse"). Default is "Root" if left empty.

Does my data leave my device?

No. All schema generation happens entirely in your browser using JavaScript. Your data never leaves your machine, ensuring complete privacy for API responses, database schemas, or any confidential data structures.

How do I use the generated schema?

Copy the generated code and paste it into your project:

- TypeScript: Save as .ts file or add to existing types
- JSON Schema: Use for validation, documentation, or code generation
- Go: Add to your .go source files
- Python: Add to .py files (works with type checkers like mypy)
- Java/C#: Add to your class files

The generated code is ready to use without modifications, though you can customize it to match your project's coding standards.