Report

Help us improve this tool

JSON To Flow Converter

Generate Flow type definitions from JSON sample data with configurable namespace, prefix, and root name in the browser.

O M T

Generate Flow types from JSON payloads

Flow is a static type checker for JavaScript that helps teams catch data shape bugs before runtime. When you receive JSON from an API, log file, or fixture, hand-writing matching Flow type aliases is slow and easy to get wrong. This converter inspects your JSON sample and emits Flow-ready type declarations you can paste into a // @flow file.

What this tool does

Paste JSON in the input panel. The generator walks nested objects and arrays, infers primitive and composite types, and outputs Flow type aliases with optional namespace wrapping. You can customize the root type name, interface prefix, and namespace to match your project conventions.

Configuration options

  • Namespace: Wrap generated types inside a Flow namespace block.
  • Type Prefix: Control the prefix added to generated type names (default I).
  • Root Type Name: Rename the top-level type instead of using RootObject.

Common use cases

  • Bootstrap Flow types for REST API responses during service integration.
  • Document expected payload shapes for legacy JavaScript codebases.
  • Generate starter types before refactoring untyped modules.
  • Compare inferred types against GraphQL or OpenAPI contracts.

Related tools

Need TypeScript instead of Flow? Try the JSON to TypeScript POJO Generator. For GraphQL schemas, use the GraphQL to Flow Converter or convert Flow declarations with the Flow to TypeScript Converter.

Frequently Asked Questions

Does my JSON leave the browser?

No. Conversion runs entirely in your browser. Your JSON is never uploaded to a server, which makes the tool safe for internal API samples and production-like fixtures.

What JSON shapes are supported?

The converter works with JSON objects and arrays of objects. Primitive root values are not supported because Flow root aliases typically describe structured records.

How is this different from the GraphQL to Flow Converter?

This tool infers types from JSON samples. The GraphQL to Flow Converter generates Flow types from GraphQL schema and operation documents instead of raw JSON payloads.

Can I remove the default I prefix from type names?

Yes. Clear the Type Prefix field or set it to an empty value to stop adding a prefix to generated type aliases.

Will the output work with Flow strict object types?

The generated aliases describe the inferred JSON shape. You may still want to tighten optional fields or add exact object syntax after pasting the result into your codebase.