JSON to Dart Code
A VSCode extension that generates Dart model classes and service methods from Swagger 2.0 JSON documents.
Features
- 🚀 One-click Generation: Right-click on any Swagger JSON file to generate Dart code
- 📝 Model Classes: Automatically generates Dart model classes with
toJson() and fromJson() methods
- 🔧 Service Classes: Creates service classes using Dio for HTTP requests
- 🏗️ Nested Models: Supports nested object generation and proper imports
- 📁 Custom Output: Configure separate output directories for models and services
- 🎯 Smart Naming: Intelligent class and method naming based on Swagger definitions
Usage
- Open a Swagger 2.0 JSON file in VSCode
- Right-click on the file (in explorer or editor)
- Select "Generate Dart Code from Swagger JSON"
- Generated files will be created in configured directories
Configuration
{
"jsontodartcode.modelOutputPath": "lib/models",
"jsontodartcode.serviceOutputPath": "lib/services"
}
| |