Have you ever pasted a JSON payload into ChatGPT and asked it to generate a TypeScript interface or Go struct?
Usually, it works. But sometimes, it decides to be "helpful" and changes your user_id to UserId, or completely forgets an optional field. In a production CI/CD pipeline, this kind of AI hallucination is a nightmare.
I got tired of this, so I built TypeFlow: A developer tool that converts JSON, SQL, or YAML into 16+ languages instantly. But the real secret isn't just AIβit's a Hybrid Architecture.
The Problem: AI is smart, but unpredictable
When dealing with Data Transfer Objects (DTOs), schemas, and type definitions, you need 100% deterministic output. If an AI "guesses" a type wrong, your app crashes.
Legacy tools like QuickType are fully deterministic but feel outdated and struggle with broken syntax. Modern devs just use AI, but sacrifice reliability.
The Solution: The Hybrid "TypeFlow" Engine

I wanted the absolute reliability of a compiler, mixed with the "magic" of an LLM. Here is how I built the TypeFlow engine:
1. The Core: Pure AST Parsing (Zero AI)
When you paste JSON or SQL into TypeFlow, it doesn't go to an LLM. Instead, I wrote a custom parser that reads the input and builds a Unified Abstract Syntax Tree (AST) entirely in the browser.
From that single AST, the engine deterministically generates 16 different outputs (TypeScript, Python Pydantic, Go Structs, Rust, Swift, etc.) in 0.01 seconds.
Result: Zero hallucinations. 100% reliable types.
2. The Magic: AI for Semantics and Healing
If the core is pure logic, where does the AI come in? I used the Gemini API for the things logic can't do easily:
- Schema Healing: If you paste broken JSON (missing commas, trailing brackets), the AI intercepts it, heals the syntax instantly, and passes it to the AST parser.
-
Semantic Zod Validation: AST parsers just see
string. I added an AI feature that reads the context of your data and infers semantic rules, automatically generatingz.string().email()orz.string().uuid()for Zod validation. - Mermaid ER Diagrams: The AI reads the AST structure and generates beautiful Mermaid database relationship diagrams in real-time.
The Tech Stack
- Frontend: Next.js 14 (App Router) + TailwindCSS
- Editor: Monaco Editor (VS Code engine in the browser)
-
AI: Gemini 2.5 Flash (Using Server-Sent Events
alt=ssefor real-time code streaming) - Hosting: Cloudflare Pages (Blazing fast global edge delivery)
Try it out!
I just launched the beta version. It's completely free to use right now.
Check it out here: TypeFlow.pro
Let me know what you think! Have you experienced AI hallucinations breaking your code before? Drop a comment below!π
Top comments (0)