JSON ↔ YAML Converter Online
Convert JSON sang YAML và ngược lại. Realtime, error inline. Dùng js-yaml chuẩn YAML 1.2. Useful cho config Kubernetes / CI/CD / docker-compose.
name: DevTools version: '1.0' features: - JSON - YAML - TOML
Vì sao dùng tool này
Toggle direction 1 click — convert JSON sang YAML hoặc ngược lại không đổi tool.
Output YAML 2-space indent, lineWidth 120. JSON output 2-space indent, có thể minify.
YAML parse error hiện line + reason cụ thể. Sửa nhanh.
Cách sử dụng
- 1Chọn direction: JSON→YAML hoặc YAML→JSON.
- 2Paste source vào textarea trái.
- 3Output realtime bên phải. Copy nếu ưng.
JSON ↔ YAML
YAML (YAML Ain't Markup Language) là superset của JSON với syntax human-friendly hơn (indent thay {}, # comments, multiline string). Dùng phổ biến trong Kubernetes, docker-compose, GitHub Actions.
Tool dùng js-yaml lib chuẩn YAML 1.2 spec. JSON.parse cho parse JSON. Round-trip JSON → YAML → JSON đảm bảo data integrity.
- ✓JSON 1.2 spec compliant (js-yaml)
- ✓Bidirectional convert
- ✓2-space indent default
- ✓Multiline strings preserved
- ✓Error reporting với line
- ✓Realtime convert
- ✓100% client-side
Câu hỏi thường gặp
Support TOML không?
Phase 1 chỉ JSON ↔ YAML. TOML (cargo, pyproject) sẽ thêm Phase 2.
YAML có support anchor (&, *)?
Có. js-yaml expand anchors khi parse — JSON output sẽ duplicate value.
Comment YAML có giữ khi convert sang JSON?
Không. JSON không có comment. Comment YAML bị strip.