XML to Flow Converter Online

Paste any XML and generate Flow type aliases using exact object types ({|...|}). XML attributes are preserved as '@_'-prefixed string fields (the fast-xml-parser convention) so the type validates the JSON form of your XML losslessly — all in your browser.

What is an XML to Flow converter?

An XML to Flow converter takes a real XML document and emits Flow type aliases that describe the JSON form of that XML — typically the JSON you would get from fast-xml-parser. The OpenFormatter generator infers string, number, boolean, Array<T>, and nested exact types, preserving XML attributes as @_-prefixed fields. The output uses exact object types ({|...|}) so unknown extras are rejected at type-check time.

XML differs from JSON in two ways your Flow type has to honour. First, XML has attributes on elements (<book id="bk101">) — these become '@_id' fields inside the type alias (quoted because @ is not a valid JavaScript identifier). Second, XML allows arbitrary repetition; the generator emits Array<T> for repeated children with the inner type inferred from the first occurrence.

Sample XML and the Flow type it generates

Input XML

<book id="bk101" lang="en">
  <title>Flow in Action</title>
  <year>2019</year>
  <price currency="USD">24.99</price>
</book>

Generated Flow

// @flow

type Price = {|
  '@_currency': string,
  '#text': number,
|};

type Book = {|
  '@_id': string,
  '@_lang': string,
  title: string,
  year: number,
  price: Price,
|};

Notice the type uses {|...|} — Flow's exact object syntax that forbids unknown extras. Attribute keys are quoted ('@_id') because @ is not a valid JavaScript identifier. The nested Price type captures both the attribute and the text content of <price currency="USD">24.99</price>.

How to convert XML to Flow — 4 steps

  1. Paste your XML. A SOAP envelope body, an RSS feed entry, an enterprise XML response — anything well-formed.
  2. Click Convert. The browser parses the XML and generates Flow exact-type aliases for the full element tree.
  3. Mark optional fields. Append ? to keys you know can be absent; the generator stays neutral.
  4. Cast the parser output. Use const data: Root = (parser.parse(xml): any) and let Flow check downstream usage.

Exact Object Types

Generated types use {|...|} so Flow rejects unknown extras at type-check time — matching the closed-shape semantics of XML against a known schema.

Attribute Prefix @_

XML attributes become @_-prefixed quoted keys — matches fast-xml-parser output so the type validates real component data losslessly.

Client-Side Only

Your XML — including SOAP responses with credentials — is parsed in JavaScript on your machine. Verify in DevTools: zero network requests on Convert.

Common use cases

  • check_circleType SOAP API responses inside a Flow-typed React Native app
  • check_circleAdd Flow types to RSS / Atom feed reader code in a Meta-aligned codebase
  • check_circleGenerate exact types for an enterprise XML payload your component consumes
  • check_circleBridge fast-xml-parser output to React component prop types
  • check_circleCatch shape drift between back-end XML and front-end Flow code
  • check_circleType sitemap.xml or robots.xml shape inside an admin dashboard
  • check_circleAdd type checks to legacy JavaScript that still uses Flow over TypeScript
  • check_circleDocument the JSON shape of an XML API for downstream maintainers

Why client-side conversion matters

SOAP responses and enterprise XML often contain customer PII, API tokens, internal endpoint names, and database identifiers. Pasting them into a server-hosted converter is a compliance violation in most regulated industries. OpenFormatter parses the XML and generates Flow source entirely in JavaScript on your device — no upload, no logs, no cookies. Open DevTools → Network and confirm no requests fire when you click Convert.

More XML tooling

Validate, format, or convert XML to other languages — every tool runs locally in your browser.

Frequently Asked Questions

Are Flow types still relevant in 2026?

Yes, in specific contexts. TypeScript dominates the broader ecosystem, but Meta still uses Flow internally across their massive React/React Native monorepos and ships open-source projects (Relay, Recoil, Hermes) with Flow type annotations. Flow has features TypeScript still does not (true exact object types via {|...|}, structural variance opt-in, opaque types). If you maintain code that targets Meta-aligned tooling or want stricter object shape checks, Flow remains a sensible choice.

Why exact object types ({|...|}) instead of regular ({...}) ?

Exact object types in Flow forbid extra properties at type-check time, matching XML semantics where a known schema means "these fields and only these fields". Regular {...} permits unknown extras, which is too loose for XML round-tripping. The generator emits exact types by default — drop the |s if you genuinely need width subtyping.

How are XML attributes typed in Flow?

XML attributes become @_-prefixed string fields inside the type alias — matching the convention fast-xml-parser uses when it converts XML to JSON. Because @ is not a valid JavaScript identifier the key is wrapped in single quotes, e.g. quoted-attr-id colon string. Flow treats quoted keys identically to bare keys for type checking.

How are repeated elements typed?

Repeated child elements become Array<T> with T inferred from the first occurrence. Flow has both Array<T> and $ReadOnlyArray<T>; the generator picks the mutable variant. Switch to $ReadOnlyArray if your component only reads from the array — the stricter type catches accidental mutations at type-check time.

How does Flow compare to TypeScript for XML data?

TypeScript has a far larger community, more libraries with built-in types, and IDE tooling that ships out of the box. Flow has true exact types, opaque types, and tighter inference for React props. Both compile away cleanly — neither adds runtime cost. If your project already uses Flow, this generator slots in; if you are starting fresh, our XML to TypeScript generator is the more conventional choice.

Does the type include optional fields?

No. Required-vs-optional cannot be inferred from a single XML sample (the example you paste might be a maximal instance). Append a question mark to any field key you know is optional, e.g. lang?: string, and Flow will permit it being absent. The generator deliberately stays neutral.

Is the XML I paste sent to your servers?

No. XML is parsed by the browser DOMParser and the Flow type source is generated entirely in JavaScript on your machine. Open DevTools → Network and you will see no requests when you click Convert. Safe for SOAP responses and configuration files containing API keys or credentials.

How do I use the generated type with a fast-xml-parser result?

Cast the parser output: const data: { book: Book } = (parser.parse(xml): any); — the colon-cast brings the type checker on board. Flow will then enforce that downstream code respects the @_id, title, etc. fields. For stricter parses use the tagValueProcessor option of the parser to coerce numeric strings before casting.

XML to Flow Converter Online — Free Type Generator