What this tool does
A JSON sample becomes Flow type aliases, one per object.
{ "id": 1, "name": "Ada", "address": { "city": "Paris" } }
export type Root = {
id: number,
name: string,
address: Address,
};
export type Address = {
city: string,
};
A list at the root is named too:
export type Users = UsersItem[];
That alias used to be missing — the item type came out alone, and the root name you had set went nowhere. It was found while writing this page and fixed.
Exactness is not ours to decide
The output writes { … }, neither {| … |} nor a trailing .... Under exact_by_default=true, which recent Flow versions enable, that object is exact: an extra property is an error. Without the flag it is inexact and extra properties are allowed.
Both are defensible, and the difference is a project-wide decision recorded in your .flowconfig. Writing the sigil either way would override that decision on the basis of a sample that says nothing about it, so the generated type simply follows your configuration.
mixed, not any
An empty array gives mixed[]; a value of unknown shape gives mixed. The point of mixed is that Flow makes you narrow it before use, which is what you want when the type really is unknown. any would look tidier in the output and disable the checker exactly where the data is least understood.
What one document cannot say
Nothing is optional: name: string means present, because the sample had it. If the field is sometimes absent, name?: string is the edit to make, and string | null if it can be null — the sample only proves what it contains.
A mixed array becomes a union type, (number | string)[], which describes the sample precisely and may be wider or narrower than your real data. And a key that is not a valid identifier keeps its quotes: "content-type": string.
Private by design
Everything runs locally in your browser with JavaScript. Your data is never uploaded, which makes the tool safe for sensitive content, and it keeps working offline.