ToolZoneX
Blog

JSON to Flow Type Converter

Paste a JSON sample to instantly generate matching Flow exact object types, with nested objects, optional fields, and nullable fields inferred automatically. Free online developer tool.

Paste JSON
Flow Types
Flow type definitions will appear here...

Free JSON to Flow Type Converter

Paste a JSON sample to instantly generate matching Flow exact object types ({| ... |}). Nested objects become their own named types, arrays become typed arrays, and fields that are missing or null in your sample are marked optional or nullable automatically.

How to Use It

Paste any JSON object or array into the input box, or click "Load Example" to see a sample run. The converter parses your JSON, infers a type shape from the values it finds, and generates one Flow type per object level — nested objects are pulled out into their own type named after the parent property, so the output stays readable even for deeply nested payloads.

Example

Given {"name": "Ann", "age": 30, "tags": ["a","b"], "address": {"city": "NYC", "zip": null}}, the tool generates a RootAddress exact object type for the nested object plus a Root type referencing it, with tags: string[] and a leading ? on any field that was ever seen as null.

Common Use Cases

  • Typing an API response quickly in a Flow-typed codebase without hand-writing types field by field.
  • Bootstrapping types for a third-party webhook payload or config file.
  • Checking at a glance which fields in a JSON sample are optional or nullable.
  • Prototyping types before deciding whether to migrate a module to TypeScript instead.

FAQs

Why does the output use exact object types ({| ... |})?

Exact object types reject extra properties that aren't declared, which best matches what was actually observed in your sample. If you need Flow's more permissive inexact objects instead, just remove the | from each opening and closing brace after copying the output.

How are optional and nullable fields different in Flow?

A trailing ? on the property name (e.g. zip?: string) marks a field optional — it can be entirely missing. A leading ? on the type itself (e.g. ?string) marks it nullable — the key is present but its value can be null. This tool applies each based on what it actually saw in your sample.

Is my JSON uploaded anywhere?

No — parsing and type generation happen entirely client-side in your browser. Nothing you paste is sent to a server.