An IntelliJ IDEA plugin that generates type-safe code from JSON data. Paste your JSON and instantly get TypeScript interfaces, type aliases, and more.
- JSON to TypeScript: Automatically infer types from JSON data
- Multiple Output Modes: Generate separate interfaces or nested inline types
- Naming Strategies: Support for camelCase, PascalCase, snake_case, or preserve original names
- Type Merging: Intelligently merge similar object structures
- Real-time Preview: See generated code as you type
- Customizable Options: Configure output format per language
The project follows a clean multi-module architecture:
schema-to-code/
├── core/ # Platform-independent business logic
│ └── src/main/kotlin/
│ └── .../core/
│ ├── config/ # Configuration classes (TargetLanguage, InputFormat, etc.)
│ ├── emit/ # Code emitters (TypeScript, etc.)
│ ├── i18n/ # Internationalization support
│ ├── infer/ # Input parsing (JSON inference)
│ ├── ir/ # Intermediate representation (TypeDef, Field, etc.)
│ ├── language/ # Language descriptors
│ ├── naming/ # Naming strategies (camelCase, PascalCase, etc.)
│ ├── normalize/ # Type normalization and merging
│ ├── options/ # Option definitions
│ ├── resolve/ # Type name resolution
│ ├── result/ # Result types for error handling
│ ├── service/ # Main service (SchemaToCodeService)
│ └── util/ # Utility functions
│
└── plugin/ # IntelliJ IDEA plugin
└── src/main/kotlin/
└── .../plugin/
├── language/ # Language registry and IDs
├── state/ # Persistent settings
├── ui/ # UI components (panels, editors)
├── util/ # UI utilities
└── viewmodel/ # MVVM view models
JSON Input → Parse (Infer) → Normalize → Plan → Emit → TypeScript Output
- Infer: Parse JSON and create intermediate representation (IR)
- Normalize: Merge structurally equivalent types
- Plan: Allocate unique names and collect type declarations
- Emit: Generate target language code
Schema to Code converts JSON data into type-safe code instantly.
Features:
- Generate TypeScript interfaces or type aliases from JSON
- Multiple naming strategies (camelCase, PascalCase, snake_case)
- Separate or nested type emission modes
- Real-time code generation as you type
-
Using the IDE built-in plugin system:
Settings/Preferences > Plugins > Marketplace > Search for " schema-to-code" > Install
-
Manually:
Download the latest release and install it manually using Settings/Preferences > Plugins > ⚙️ > Install plugin from disk...
- Open the Schema to Code tool window (View → Tool Windows → Schema to Code)
- Paste your JSON in the left editor
- Configure options (language, naming strategy, emission mode)
- Copy the generated code from the right editor
./gradlew build./gradlew testContributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License.
- Support TypeScript code generation
- Support JSON input parsing and inference
- Support multiple naming strategies (camelCase, PascalCase, snake_case, preserve)
- Support separate and nested type emission modes
- Real-time code generation and preview in IntelliJ
- Customizable options per language
- Support C# code generation
- Support Kotlin code generation
- Support Java code generation
- Support reading and generating code from OpenAPI schema
- Support reading and generating code from Swagger schema
Plugin based on the IntelliJ Platform Plugin Template.