Types inferred from evidence — edit them deliberately.
A non-empty object at the root becomes export interface Root. Anything else becomes a type alias, because an interface body must be an object literal. Keys that are not legal identifiers are quoted.
{
"id": 1,
"tags": ["a"],
"mixed": [1, "x"],
"meta": { "ok": true }
} export interface Root {
id: number
tags: string[]
mixed: (number | string)[]
meta: {
ok: boolean
}
}
What a single sample cannot show
- ▸Every property comes back required. One document cannot prove a field is sometimes absent, so mark those with
?yourself. - ▸An empty array becomes
unknown[]and an empty objectRecord<string, never>: honest, and both worth replacing. - ▸String values stay
string. If a field carries an enum, write the union of its values by hand or the type will accept anything. - ▸Feed an array of records and the element type becomes a union of the observed shapes, so a field present in only some records appears as a separate variant rather than an optional property.
NOTE The exported type is always named Root; rename it once in your editor. Nested objects stay inline, which keeps the output small enough to review — extract them into named interfaces when the shape is reused.
What you get on this page
- ▸Infers string, number, boolean and null
- ▸Nested objects become inline interfaces
- ▸Mixed arrays become union types
- ▸Invalid property names are quoted automatically
Because bracekit is a static application, this page loads quickly, caches well and never sends your data to a parsing server. Your formatting preferences, recent documents and snippets stay in local storage.