All Over Tools logo
Tool Combiner
Analyze Tools Clean Tools Compare Tools Convert Tools Data Validation Extract Tools Format Tools Generate Tools Organize Tools Transform Tools
Image Tools Video Tools Audio Tools Subtitle Tools Font Tools
Analyze Tools Clean Tools Compress Tools Convert Tools Edit Tools Extract Tools Generate Tools Merge Tools Organize Tools Redact Tools Repair Tools Split Tools
Analyze Tools Clean Tools Compare Tools Convert Tools Extract Tools Generate Tools Merge Tools Transform Tools Validate Tools
Business Calculators Construction Calculators Date And Time Calculators Education Calculators Financial Calculators Food Calculators Health Calculators Math Calculators Science Calculators Sports Calculators Statistics Calculators
Blog About Us Contact Us

YAML to JSON Converter

Paste or upload a YAML file and convert it into JSON. Mappings, sequences, scalar types, and nulls are preserved exactly, anchors/aliases/merge keys are resolved, and multi-document files (separated by ---) are handled according to the policy you choose. Invalid YAML is flagged with a precise line and column. Everything runs locally in your browser.

Drop a YAML file here

or

YAML, YML, TXT

YAML input

How to Convert YAML to JSON

  1. Paste YAML into Paste YAML content below, or drop/upload a .yaml, .yml, or .txt file. The drop zone accepts YAML, YML, TXT.
  2. Choose a Multi-document policy if the input contains documents separated by ---.
  3. Choose Pretty (indented) or Compact (minified) under Output format.
  4. For indented output, choose 2 spaces, 4 spaces, or Tab under Indent size.
  5. After you paste or upload usable YAML, the parser reads it in your browser and places the result under JSON output automatically.

Choose multi-document handling

Use Multi-document policy when the input contains more than one document. Select one of these options:

  • Auto (single value if 1 doc, array if more) outputs one value for one document and an array for multiple documents.
  • Always output an array of documents always returns an array.
  • Convert first document only ignores later documents.
  • Error if more than one document stops when the input contains multiple documents.

Changing this control reprocesses non-empty input immediately.

Choose output formatting

Select Pretty (indented) for readable line breaks, or Compact (minified) for a single compact JSON value. With indented output, choose 2 spaces, 4 spaces, or Tab. Changing the output format or indent size updates an existing result.

Copy, download, or clear the result

  • Use Copy JSON to copy a converted result. The button stays disabled until conversion succeeds.
  • Use Download JSON to save the result as converted.json. It is also disabled until conversion succeeds.
  • Use Clear to reset the current input and result.

Supported behavior and parser limitations

The implementation uses a self-contained YAML subset parser. The page does not provide a complete supported-syntax matrix, so do not assume that every YAML feature is accepted.

  • It handles block and flow mappings and sequences, quoted and plain scalars, nulls, booleans, integers, and floats.
  • Anchors and merge keys are expanded when used. An alias must refer to an anchor already available at that point in parsing; otherwise it produces a parse error.
  • .inf, -.inf, and .nan become JavaScript non-finite values. When serialized with JSON, those values become null.
  • Literal (|) and folded (>) block scalars are handled, but trailing blank lines and final newline behavior are not guaranteed to be preserved exactly.
  • The tool converts YAML to JSON only. It does not edit or clean the original YAML, and it does not convert JSON back to YAML.

Troubleshooting conversion failures

  • If the input is empty, the tool shows Paste or upload YAML content first.
  • If a selected file cannot be read, it shows Could not read this file.
  • If copying fails, it shows Could not copy to clipboard.
  • YAML syntax and parser errors include a reported line and column. The multi-document error from Error if more than one document is a generic policy error without a source location.

Large-file preview behavior

If a selected file is longer than 200,000 characters, the textarea shows only the first 200,000 characters and adds a truncation notice. The full file remains in rawText and is processed. The implementation does not define a maximum accepted input size or a practical browser performance limit for very large content.

Privacy and processing

The conversion workflow does not upload the selected content: the browser FileReader reads it and the local parseYamlToDocuments parser processes it in your browser. The implementation does not document broader page network activity.

Frequently Asked Questions

Does converting YAML to JSON upload my file anywhere?

The conversion workflow does not upload the selected YAML content: the browser FileReader reads it and the local YAML parser processes it in your browser. The implementation does not document broader page network activity.

What happens if my YAML file has multiple --- documents?

You choose the policy: convert only the first document, wrap every document into a JSON array, automatically use a single value for one document and an array for more than one, or raise an error if more than one document is found.

How are YAML anchors and aliases handled?

An anchor (&name) is resolved to its value and substituted where the matching alias (*name) or merge key (<<: *name) appears. The anchor must already be available when the alias is parsed; otherwise the tool reports a parse error with its location.

What happens if my YAML is invalid?

YAML syntax and parser errors report a line and column and name the problem, such as inconsistent indentation, a tab used for indentation, an unknown escape sequence, a missing mapping colon, malformed flow punctuation, an unterminated quoted or flow value, or an alias with no matching anchor. The multi-document policy error from Error if more than one document is generic and has no source location.

Can I convert the JSON output back to YAML?

No, this tool only converts YAML to JSON in one direction. It also does not modify or clean your original YAML file in place.

Related Tools

16 views