Chuyển YAML sang JSON và JSON trở lại YAML, theo cả hai chiều. Kiểm tra hợp lệ khi chuyển và hiển thị lỗi rõ ràng. Mọi thứ chạy trong trình duyệt của bạn.
Cách dùng YAML ⇄ JSON
Chọn chiều: YAML sang JSON hoặc JSON sang YAML.
Dán YAML hoặc JSON của bạn vào khung đầu vào.
Sao chép kết quả đã chuyển, hoặc đọc lỗi nếu đầu vào không hợp lệ.
This converter transforms YAML into JSON and JSON into YAML, in both directions. Pick the direction, paste your input, and copy the converted result or read a clear error if the input is malformed.
Everything is processed locally in your browser, so your data stays on your device.
YAML and JSON describe the same kind of data, but with different priorities. JSON is strict and compact, which suits APIs and machines; YAML is indentation-based and easier for people to read and edit, which is why it dominates configuration files.
Each conversion parses the source first, so malformed input is caught and reported with the reason and often the line, instead of silently producing a broken result. A successful conversion therefore also tells you the input was valid.
It uses the YAML 1.2 and 1.1 compatible parser from js-yaml, covering the features you meet in practice: mappings, sequences, scalars, anchors and multi-line strings.
This is exactly the glue you need around CI pipelines, Kubernetes and Docker Compose files, and APIs that speak JSON while your config is written in YAML. It lets you move between the two without hand-editing.
One thing to know: YAML comments are dropped, because JSON has no concept of comments, and converting back generates fresh YAML without them.
Câu hỏi thường gặp
Nó dùng trình phân tích tương thích YAML 1.2 / 1.1 từ js-yaml, bao quát các tính năng phổ biến: ánh xạ, chuỗi tuần tự, vô hướng, neo và chuỗi nhiều dòng.
Đầu vào được phân tích trước khi chuyển, nên YAML hoặc JSON không hợp lệ sẽ hiển thị thông báo với lý do và thường cả dòng, giúp bạn phát hiện vấn đề nhanh.
Không. Chú thích YAML bị loại bỏ trong quá trình chuyển vì JSON không có chú thích, và chuyển ngược lại sẽ tạo YAML mới không có chúng.
Không. Việc chuyển đổi chạy hoàn toàn trong trình duyệt của bạn; không gì bạn dán rời khỏi thiết bị.
Nhúng công cụ này
Thêm công cụ này vào trang web của riêng bạn. Sao chép đoạn mã bên dưới; nó tự động cập nhật.
<iframe src="https://monu.tools/embed/vi/yaml-json-converter" width="100%" height="640" style="border:1px solid #e5e5e5;border-radius:12px;max-width:680px" loading="lazy" title="Monu Tools"></iframe>Công cụ liên quan
Định dạng, làm đẹp và kiểm tra JSON trực tuyến với thông báo lỗi rõ ràng cho dữ liệu nhập không hợp lệ.
Thu gọn và kiểm tra hợp lệ JSON trong trình duyệt của bạn, và xem bạn tiết kiệm được bao nhiêu byte.
Chuyển JSON sang CSV và CSV trở lại JSON, theo cả hai chiều. Chọn dấu phân tách, xử lý các trường có dấu ngoặc kép, và sao chép kết quả. Mọi thứ chạy trong trình duyệt của bạn.
Tạo interface TypeScript từ một mẫu JSON, với kiểu lồng nhau, mảng và trường tùy chọn. Chạy trong trình duyệt của bạn.