Skip to content
UniKit

JSON to YAML converter

Convert JSON to YAML with configurable indent, line width, key sorting and forced quotes; special characters like @, { and } are quoted automatically and syntax errors report exact line and column.

Runs in your browserEvery computation happens in your browser — your data never leaves this device.

JSON input
80

YAML

name: UniKit
version: 1.0.0
tags:
  - tool
  - frontend
author:
  name: UniKit team
  homepage: https://example.com
  email: '@team'
private: true

Special characters such as @, {, }, : and # are quoted automatically.

Structure

Keys8
Objects2
Arrays1
Scalars8
Depth2
JSON lines11
YAML lines10
Bytes146

What this tool does

  • Write YAML-only configs — Kubernetes manifests, GitHub Actions, Docker Compose, Ansible — by drafting JSON first and converting it in one step.
  • Avoid YAML indentation bugs: pick a 1–8 space indent and cap the line width so long strings do not wrap where you did not expect.
  • Validate the JSON on the way in: invalid input reports the exact line and column plus a snippet of the offending line, which beats the raw JSON.parse message.
  • Characters with special meaning in YAML (@, {, }, :, #) are quoted by js-yaml automatically, so you never have to guess which value needs quotes.

Example

Input

{"name":"UniKit","version":"1.0.0","tags":["tool","frontend"]}

Output

name: UniKit
version: 1.0.0
tags:
  - tool
  - frontend

Defaults: 2-space indent, 80-column width, and repeated objects are expanded instead of emitted as &anchor / *alias pairs.

Frequently asked questions

Why is the value 1.0.0 quoted?

Unquoted scalars that look numeric are risky: 1.0 would be read back as a number, and something like 1.0.0 is not a valid float at all. js-yaml quotes anything ambiguous so re-parsing the YAML yields the same types you started with.

What are anchors and aliases, and when should I turn them off?

YAML can define a repeated object once with &anchor and reference it with *alias — smaller output, worse readability, and many parsers do not support it. The default "expand repeated objects" writes every object out in full, which is safer for tools like Kubernetes.

Can I use 4-space or tab indentation?

Indentation can be anywhere from 1 to 8 spaces; out-of-range values are clamped to the nearest bound. The YAML spec forbids tab indentation, so tabs are not offered.

What line width should I pick?

The default of 80 columns wraps long scalars at sensible points, which keeps diffs readable. Tick "no line wrapping" to keep every value on a single line.

Is my JSON uploaded anywhere?

No. Parsing and serialization run locally in your browser with JavaScript, there are no network requests, and it works offline.

Keywords:json to yamlJSON 转 YAMLyaml转换convertkvconfig序列化

Related tools