YAML → JSON / handoff guide

Hand off YAML to JSON without losing types

Before moving a configuration, check strings, booleans, null, and the boundaries that should stop a conversion.

Fix the types first

Similar-looking values can have different types. Quote identifiers and dates when their string meaning must survive the handoff.

id: "001"
enabled: false
label: on
date: "2026-10-01"
note: null
YAMLJSON type to check
"001"string; keeps the leading zero
falseboolean
oncheck the string boundary explicitly
"2026-10-01"string, not an implicit date
nullnull

Boundaries to check

  • Use YAML 1.2/core scalar expectations; do not assume every parser makes the same implicit conversions.
  • Treat duplicate keys as reject or visible warning, never as safely resolved last-key-wins.
  • Comments are not values. Explain anchors and aliases, but do not resolve external files or URLs.
  • Reject circular structures because JSON cannot serialize them. Use 1 MiB and depth 32 as visible limits.

The existing converter also runs locally. It does not upload, resolve external references, or perform schema validation.

Fixture decisions

fixtureexpectedwhy
normal-typesconvertcheck quoted identifier/date, boolean, and null
duplicate-keyreject / visible warningdo not silently choose last-key-wins
alias-referencewarnmake reference meaning visible without external resolution
cyclerejecta cycle cannot become JSON
oversized-deeprejectcrosses the 1 MiB or depth 32 boundary

Run the conversion

When you need to convert the input locally, use the existing YAML to JSON converter. This guide provides the decision points and handoff note.

English converter / 日本語の変換ツール