Generate Dart data classes from JSON effortlessly. This extension is designed for Flutter and Dart developers who want a fast, customizable, and beautiful tool for model generation.
- ✨ Beautiful & User-Friendly UI: A clean, modern interface that fits right into VS Code.
- 🚀 Multiple Serialization Strategies:
- JSON Serializable: Generates code compatible with
json_serializableandbuild_runner. - Manual: Generates standard Dart classes with
fromJsonandtoJsonmethods. - Custom: Define your own annotation formats and imports.
- JSON Serializable: Generates code compatible with
- ⚙️ Advanced Customization:
- Type Detection: Choose between Auto-detect, Nullable, or Non-nullable types.
- Default Values: Initialize fields with null, non-null defaults, or leave them uninitialized.
- 💾 Persistent Settings: Your preferences are saved automatically, so you don't have to reconfigure them every time.
- 🔌 Custom Annotations: Full control over class and property annotations for advanced use cases.
You can install the extension directly from the Visual Studio Code Marketplace:
- Open VS Code
- Open the Extensions View (
Ctrl+Shift+X) - Search for:
- json to dart plugin
- or 0xJihan.json-to-dart-plugin
- Click Install
- Reload VS Code if prompted
- Visit:
https://marketplace.visualstudio.com/items?itemName=0xJihan.json-to-dart-plugin - Click Install
- VS Code will open automatically and install the extension
- Select and Right Click on Folder where you want to create the model class
- Select "JSON to Dart: Generate Class"
- Paste your JSON into the input area
- Select your desired settings (Serialization, Types, Defaults)
- Click Generate Dart Code
- Open the command palette (
Cmd+Shift+PorCtrl+Shift+P) - Run "JSON to Dart: Generate Class"
- Paste your JSON into the input area
- Select your desired settings (Serialization, Types, Defaults)
- Click Generate Dart Code
Unlike other JSON to Dart converters, this tool prioritizes user experience and flexibility. It doesn't just dump code; it gives you control over how that code is generated. Whether you strictly follow json_serializable or have a custom architecture, this plugin adapts to your workflow. Plus, it remembers your choices, saving you valuable time.
Contributions are welcome! Please feel free to submit a Pull Request or open an issue on GitHub.
MIT