# JSON to Models Converter - Technical Documentation This document provides a detailed technical overview of the JSON to Models converter project, its architecture, and implementation details. ## Project Structure - `/src`: Core application source code - `/components`: UI components powered by shadcn/ui - `/sections`: Landing page sections (HowToUse, FAQ, etc.) - `/options`: Language-specific configuration components - `/lib`: Core business logic - `/languages`: Language-specific generator implementations - `typescript.ts` - `java.ts` - `csharp/` - `swift.ts` - `kotlin.ts` - `dart.ts` - `codeGenerator.ts`: Main entry point for code generation - `schema-utils.ts`: Utility functions for JSON parsing and type inference - `/hooks`: Custom React hooks (e.g., `useCodeGeneration.ts`) - `/pages`: Application routes (`Index.tsx`, `NotFound.tsx`) ## Core Logic: Code Generation The application follows a three-step process to convert JSON to code: 1. **JSON Parsing & Inference**: The `parseJson` and `inferType` functions in `schema-utils.ts` convert raw JSON strings into an internal `JsonType` schema representation. 2. **Schema Transformation**: Options selected by the user (like `nullSafety` or `makeAllOptional`) are applied to the inferred schema using `applyOptions`. 3. **Code Generation**: The `CodeGenerator` class dispatches the processed schema to a language-specific generator (e.g., `TypeScriptGenerator`), which produces the final code string. ## Supported Languages & Specific Features ### TypeScript - Supports both `interface` and `class` generation. - Options for `typesOnly` (no runtime code). ### Dart/Kotlin/Swift - Strong support for null-safety features. - Support for framework-specific patterns like `Freezed` (Dart) or `JSON Serializable`. ### Java/C# - Generates standard POJO/DTO classes with appropriate accessors and annotations. ## UI and State Management - **Tailwind CSS & shadcn/ui**: Used for the layout, dark mode, and interactive components. - **useCodeGeneration Hook**: Manages the main state including input JSON, selected language, options, and the generated output. It uses a debounced effect to trigger regeneration as the user types. ## Development and Build - **Vite**: Used for lightning-fast development and optimized production builds. - **TypeScript**: Ensures type safety across the entire codebase. - **Eslint**: Maintains code quality and consistency. ## SEO and Metadata The project includes optimized `index.html` with meta tags and a comprehensive `robots.txt` and `llms.txt` for better discoverability and AI-friendly documentation.