YAML to JSON and TypeScript Converter

Paste YAML or JSON config and instantly get formatted YAML, formatted JSON and a TypeScript interface side by side, with clear parse errors.

About YAML to JSON and TypeScript Converter

Paste a configuration file, choose whether it is YAML or JSON, and the tool parses it as you type. Three outputs update together: a cleanly formatted YAML version, a JSON version indented with two spaces, and a TypeScript interface named AppConfig that describes the structure.

The interface generator infers string, number and boolean fields, nests objects inline, and types arrays from their first element (empty arrays and null values become any). If the input cannot be parsed, the error message from the parser is shown under the input box so you can find the problem line. Each output has its own copy button. Everything runs in the page, which makes it handy for converting deployment settings, app configs or API samples without pasting them into a remote service.

How to use it

  1. Select YAML or JSON as the input format.
  2. Paste or type your configuration into the input box.
  3. Fix any parse error shown below the input.
  4. Click Copy on the YAML, JSON or TypeScript panel you need.

Questions

Does it support TOML or other formats?

No. Input can be YAML or JSON, and output is YAML, JSON and a TypeScript interface.

How are arrays typed in the TypeScript output?

The type of the first element is used for the whole array, so a list of strings becomes string[]. Empty arrays are typed as any[].

Are comments in YAML kept?

No. The YAML is parsed into data and written out again, so comments and custom formatting are dropped.

More Data & Converters tools

Home · All Tools · Blog