Skip to content

JSON to YAML converter

JSON to YAML goes through our table engine rather than a tree-to-tree dump, so nested objects flatten into dotted YAML keys before output is written.

  • Converted with Table engine · nothing stored
  • Free: 5 conversions a day · 5 MB each
  • Higher limits →

From real runs

What you get — and what changes

  • Top-level array Kept

    The two JSON objects became two YAML sequence items in the same order.

  • Nested objects Changed

    customer.name, customer.city, and extra.gift were written as dotted top-level keys instead of nested mappings.

  • Arrays Changed

    The tags array became YAML scalar text such as '["priority","quoted, comma"]' rather than a YAML list.

  • Null values Kept

    The JSON null empty field stayed null in the YAML output for both records.

  • Unicode text Kept

    München, Zoë, and 東京 survived the JSON parse and YAML write as readable UTF-8 text.

  • String identifiers Kept

    The JSON strings 001 and 02134 were quoted in YAML and did not lose their leading zeroes.

Sample conversions

Nested customer records

Input
JSON: [{"id":"001","customer":{"name":"Ada","city":"München"},"tags":["priority","quoted, comma"]}]
Output
YAML included id: "001", customer.name: Ada, customer.city: München, and tags: '["priority","quoted, comma"]'.

Late nested key

Input
Second JSON record added "extra":{"gift":true}.
Output
YAML added extra.gift to both rows, with null on the first row and true on the second row.

A real JSON → YAML run

We converted our JSON sample (557 B) with Table engine on 2026-09-11. It took 1 ms and produced a 391 B YAML file, 30% smaller than the input. The engine raised no warnings.

Input · sample.json · 557 B

Array of 4 objects; keys: company, stage, arr, owner, close_date

Records
4
Keys
company, stage, arr, owner, close_date

Output · sample.yaml · 391 B

4 list items, 0 top-level keys, 20 lines

List items
4
Top-level keys
0
Lines
20

First lines of the output

yaml
- company: Northwind Traders
  stage: Proposal
  arr: 48000
  owner: R. Ayers
  close_date: 2026-10-14
- company: Contoso Ltd
  stage: Negotiation
  arr: 120000
  owner: P. Ng
  close_date: 2026-09-30
- company: Fabrikam
  stage: Qualified
  arr: 22500
  owner: R. Ayers
  close_date: 2026-11-02
- company: Tailspin Toys
  stage: Won
  arr: 64000
…

Options and when to change them

flattenSeparator
Change the dot only if downstream YAML readers treat dots as meaningful path syntax.
arrayMode
Use json for variable-length arrays; use explode when small arrays should become indexed columns before YAML output.
encoding
Use latin1 only for non-UTF-8 JSON-like files that still parse after decoding.

Do it yourself

Python json and PyYAML

bash
python - <<'PY'
import json, yaml
with open("input.json", encoding="utf-8") as f:
    data = json.load(f)
with open("output.yaml", "w", encoding="utf-8") as out:
    yaml.safe_dump(data, out, allow_unicode=True, sort_keys=False)
PY

This keeps the original JSON tree, unlike tabular-ir's flattened row model.

JSON to YAML by API or MCP

The HTTP API and the MCP server run the exact engine this page uses (Table engine); the response carries the same warnings the web converter shows. Check support first with GET /api/v1/pairs?from=json&to=yaml.

curl
curl -X POST https://filetypeconverters.com/api/v1/convert \
  -H "Authorization: Bearer $FTC_API_KEY" \
  -F "file=@input.json" -F "from=json" -F "to=yaml" \
  -F 'options={"encoding":"utf-8"}' \
  --output output.yaml

Options this engine accepts for JSON → YAML

KeyApplies toTypeDefault
encodingReading JSONutf-8 · latin1utf-8
flattenSeparatorReading JSONstring.
arrayModeReading JSONjson · explodejson
delimiterWriting YAMLstring,
newlineWriting YAML ·
sheetNameWriting YAMLstring
dialectWriting YAMLpostgres · mysql · sqlitepostgres
tableNameWriting YAMLstringdata
createTableWriting YAMLbooleantrue
API reference

When this is the wrong conversion

  • Do not choose this route when nested YAML structure must mirror the original JSON tree exactly.
  • If the target is a line-oriented event stream, convert JSON to JSONL instead of YAML.

JSON to YAML questions

Does JSON to YAML keep nested objects nested?

No. In the tabular path, nested objects flatten into keys such as customer.name. Use a direct JSON-to-YAML dumper when the hierarchy itself is the deliverable.

What happens to JSON arrays in YAML?

With the default array handling, arrays become JSON text inside a YAML scalar. Our tags field was written as a quoted string containing the array.

Will JSON string IDs keep leading zeros?

Yes in the run we inspected. Values already typed as JSON strings, such as 001 and 02134, stayed quoted strings in YAML.