SmartQueryTools

Convert JSON to YAML Online

Convert JSON files to YAML directly in your browser. Download clean, human-readable YAML — no upload required.

About converting JSON to YAML

JSON to YAML is mostly about making data easier for people to read and edit. Seed data, test fixtures, feature-flag lists and example payloads in documentation are often kept as YAML so they can carry comments and review cleanly in pull requests. An exported JSON array becomes a YAML sequence: each record starts with a dash and its keys are listed below it.

Nested structure survives. Objects become indented mappings and arrays become lists, so a record with an address object and a tags array reads as a small tree rather than a line of brackets. Long strings are never folded onto several lines, and text that contains line breaks is written as a literal block introduced by |- so the breaks stay visible.

Some values gain quotes on the way. The writer quotes any string that an older YAML parser could misread: dates such as '2026-03-02', codes like 'NO' or 'on', and numeric-looking IDs such as '007'. That is deliberate, and it prevents the Norway problem when the file is loaded again. The output also reflects the table built from your JSON, so keys missing from a record appear with null and every record lists its keys in the same order.

Not sure which format you need? Read the JSON vs YAML comparison.

Worked example

A small sample file, converted with the default settings.

Input (JSON)

[
  {
    "id": 4101,
    "title": "Login fails on Safari 17",
    "state": "open",
    "comments": 3,
    "created": "2026-03-02",
    "assignee": "maria"
  },
  {
    "id": 4102,
    "title": "Export slow, then times out",
    "state": "closed",
    "comments": 8,
    "created": "2026-03-03",
    "assignee": null
  },
  {
    "id": 4103,
    "title": "Add dark mode",
    "state": "open",
    "comments": 12,
    "created": "2026-03-05",
    "assignee": "dev-team"
  },
  {
    "id": 4104,
    "title": "Crash on empty file",
    "state": "closed",
    "comments": 0,
    "created": "2026-03-06",
    "assignee": "li.wei"
  }
]

Output (YAML)

- id: 4101
  title: Login fails on Safari 17
  state: open
  comments: 3
  created: '2026-03-02'
  assignee: maria
- id: 4102
  title: Export slow, then times out
  state: closed
  comments: 8
  created: '2026-03-03'
  assignee: null
- id: 4103
  title: Add dark mode
  state: open
  comments: 12
  created: '2026-03-05'
  assignee: dev-team
- id: 4104
  title: Crash on empty file
  state: closed
  comments: 0
  created: '2026-03-06'
  assignee: li.wei

What changes when you convert JSON to YAML

  • The JSON array becomes a YAML list. Each issue starts with "- id:" and its other keys are indented beneath it.
  • Dates are single-quoted, as in created: '2026-03-02', so loaders such as PyYAML keep them as strings instead of date objects.
  • null stays null, as on the assignee line for issue 4102.
  • Nested objects become indented mappings and arrays become lists of "- item" lines.
  • Strings that look like booleans or numbers, such as NO, on or 007, are single-quoted.

Your file is processed locally in your browser and is never uploaded. The free limit is 50 MB per file; larger files work if your device has the memory for them.

Frequently Asked Questions

Can I convert a single JSON config file such as package.json?

Yes, but the result is a one-item list, because the converter treats each top-level object as a record. The YAML starts with "- name:" and everything is indented one level. Delete the leading dash and remove two spaces of indentation to get a plain mapping.

Will converting the YAML back to JSON give me the original file?

The values will match, but not byte for byte. Keys that were missing from some records come back as null, every record lists keys in the same order, and numbers are printed from their parsed values, so 1.50 returns as 1.5.

Does the YAML output include comments?

No. JSON has no comments to carry over, and the converter adds none. That is often the reason to convert: once the data is YAML, you can add # comments to explain values before committing the file.

Related Tools