Turn a JSON sample into TypeScript interfaces with nested objects, arrays, optional fields, and primitive types inferred locally.
Related
LLMs frequently return JSON wrapped in ```json fences, with single quotes, Python literals, or unquoted keys. Repair the syntax, validate strictly, then derive TypeScript types from the cleaned output.
AI responses often look like JSON but include markdown fences, comments, Python-style literals, or JavaScript object syntax.
JSON looks like a JavaScript object literal, but it is a smaller data format with stricter syntax and no executable values.
Each JSON object becomes a TypeScript interface. The root object is named Root by default. Nested objects get their own named interface derived from the property key — a key named address produces an Address interface.
Arrays of objects merge all encountered keys across every element. If a key is absent from some items, it becomes an optional property (key?: Type). Arrays of primitives produce typed signatures like string[] or number[].