Scenario
The deployment config is documented in YAML, but the API endpoint only accepts JSON. Translating by hand looks trivial until types start drifting: YAML's unquoted true must become JSON's boolean true, not the string "true", and the - item list syntax must become a real array. A config that arrives with "active": "true" passes JSON validation and then fails the API's type check — or worse, gets coerced silently.
Broken input
name: demo
features:
- exports
- audit
active: true
Goal
Use YAML ↔ JSON Converter to produce JSON that is structurally and type-wise equivalent to the YAML source. The converter parses YAML semantics — indentation, lists, scalars — so types survive the trip.
Tool sequence
- Open YAML ↔ JSON Converter.
- Paste the YAML with its indentation intact; two-space indents are syntax, and flattening them changes the structure.
- Convert to JSON and check the two type-sensitive spots:
featuresmust be an array,activemust be an unquoted boolean. - Both check out — see the checkpoint below. If
activehad come out as"true", the YAML side probably had it quoted. - Pretty-print or minify the result for the request body with JSON Formatter, and validate against the API's expected shape with JSON Validator.
Checkpoint output
{
"name": "demo",
"features": ["exports", "audit"],
"active": true
}
features is a real JSON array and active is a boolean — the config means the same thing in both formats.
Common mistakes
- Quoting values manually during a hand-translation and turning booleans or numbers into strings.
- Forgetting indentation is meaningful in YAML — a mis-indented key silently becomes a child of the wrong object.
- Dropping list items when converting a long
- itemblock by hand. - Missing YAML's surprise scalars: unquoted
no,on, or1.0may parse as boolean or number, not the string you intended.
Related tools and lessons
- JSON Formatter - Format, minify, and filter JSON by keys.
- JSON Validator - Validate & pretty-print JSON.
- XML Formatter & Validator - Format, minify, and validate XML.
- Related lesson: Make a Nested JSON Response Readable
- Related lesson: Find the JSON Syntax Error Breaking a Request