You converted a YAML config to JSON, the tool reported success, and the output looks plausible. It is tempting to ship it. But a successful conversion only proves the file parsed. YAML carries a few features JSON does not have: anchors that repeat a block by reference, timestamps that are genuine date values, and keys that can appear twice. The converter handles each in a specific way, and if you do not know those ways, the result can behave differently from the original while looking almost identical.

The check that protects you is not a careful read. It is a short structural comparison: counts, one traced branch, and a handful of known shape changes. This guide walks through it with the free YAML to JSON Converter on Ovatly, which converts in both directions with js-yaml and runs fully locally in your browser.

Contents

  • Quick answer
  • Why a converted file still needs checking
  • What changes shape during conversion
  • The check, step by step
  • Worked example: checking the Ana record
  • Limitations and honest tradeoffs
  • Common mistakes
  • FAQs
  • Conclusion
  • References

Quick answer

Convert the YAML with the YAML to JSON Converter, then compare the two files structurally. Count the top-level keys on both sides: the numbers must match. Pick one nested branch and trace it end to end in both files. Find every anchor reference and confirm each became a complete written-out copy in the JSON. Find every timestamp and confirm it arrived as an ISO date-time string in quotes. Finally, scan values that look like numbers and confirm each has the type you expect: no quotes means a number, quotes means a string. Duplicate keys never reach this stage, because the converter reports them as an error.

Why a converted file still needs checking

A converter answers one question: can this text be parsed and rewritten in the other format? It does not answer the question you actually care about, which is whether the data still means the same thing on the other side.

YAML and JSON overlap heavily: mappings, lists, strings and numbers look nearly identical in both, which is exactly the problem. The few places where the formats differ hide in plain sight. A reference that quietly became a full copy, a date that quietly became a string, a value that quietly changed type: a skim read catches none of them. A structural check does, because it compares shape rather than vibes.

What changes shape during conversion

Four things deserve your attention every time, because they are the places where YAML and JSON do not map one to one.

Anchors are expanded. YAML lets you define a block once and reference it elsewhere instead of repeating it. JSON has no references, so the converter writes the value out in full at every reference point. The meaning survives, but the file grows, and one point of change becomes several copies that can drift apart if someone edits only one.

Timestamps become strings. A YAML timestamp is a date value in its own right. JSON has no date type, so the converter emits it as an ISO date-time string, and any code reading the JSON has to parse that string itself if it needs a date.

Duplicate keys are an error. Real-world YAML files sometimes repeat a key by accident, with two different values. Rather than guessing which you meant, the converter stops and reports an error, so a file with duplicates never produces a quietly wrong JSON.

Types follow the quoting. An unquoted 31 is a number in both formats; the same digits in quotes are a string in both. Conversion preserves this, so the check is about expectations: the receiving system may insist on one type, and only you know which.

The check, step by step

  1. Open the YAML to JSON Converter, paste your YAML, and convert. Keep the original and the result visible side by side.
  2. Count the top-level keys in the YAML, then count them in the JSON. The numbers must match. A mismatch means something was nested differently than you assumed.
  3. Choose the most deeply nested branch and trace it end to end in both versions, level by level. Deep branches are where surprises live.
  4. Search the YAML for anchor references. In the JSON, every reference should now be a complete copy of the anchored block, identical to the original.
  5. Search for timestamps. Each one should appear in the JSON as an ISO date-time string in quotes.
  6. Scan for values that look like numbers. In the JSON, an unquoted value is a number and a quoted one is a string. Confirm each one matches the type the receiving system expects.

Worked example: checking the Ana record

Start with the smallest possible YAML file:

name: Ana
age: 31

Converted, it becomes:

{
  "name": "Ana",
  "age": 31
}

The check takes seconds. Two top-level keys went in, two came out. name is the string "Ana" on both sides. age is the number 31, unquoted, because the YAML value was unquoted. Had the YAML said age: "31", the JSON would carry the string "31", and a system expecting a number could reject it. That one pair of quotes is what this check exists to catch.

Now add an anchor:

owner: &owner
  name: Ana
  age: 31
backup_owner: *owner

The JSON contains no reference. Both keys hold the full mapping, written out twice:

{
  "owner": { "name": "Ana", "age": 31 },
  "backup_owner": { "name": "Ana", "age": 31 }
}

Count the keys inside each copy: two and two, identical. A copy missing a key, or holding a different value, would mean the result no longer matches its source.

Limitations and honest tradeoffs

This check is manual and sampled. Tracing one branch deeply is far better than skimming everything, but a very large file can still hide a surprise in a branch you did not trace. Scale the sampling to the stakes: one branch for a personal config, several plus a key count at every level for a production settings file.

The converter works with YAML 1.2 core features. Files relying on custom tags or other exotic corners of YAML sit outside that, so treat a clean conversion of one with extra suspicion rather than less.

A structural check also has a hard boundary: it proves shape and types survived, not that the values are right. A wrong number in the YAML arrives as the same wrong number in the JSON.

One useful second pass: the converter works in both directions, so convert the JSON back to YAML and compare the round trip with your original. Differences that hid in one direction often stand out in the other.

Common mistakes

  • Trusting "conversion succeeded" as "data unchanged". Success means parseable. The check is what makes it trustworthy.
  • Skimming instead of counting. Your eyes glide over a missing key. A count cannot.
  • Reading an expanded anchor as a duplication bug. The file grew because references became copies. That is correct behaviour, not an error.
  • Expecting a timestamp to stay a date. JSON has no date type. It will be a string, and your code must treat it as one.
  • Deleting a duplicate key at random to silence the error. The error is doing you a favour. Decide which value is correct, then remove the other.

FAQs

Why check the JSON at all if the conversion succeeded? Success means the YAML parsed and was rewritten, not that every value kept the shape you expect. Anchors expand into full copies, timestamps turn into strings and number-looking values can change type. A structural check catches those changes before the receiving system does.

What happens to YAML anchors in the converted JSON? They are expanded. JSON has no references, so every place the YAML pointed at an anchor receives the full value written out. Check each copy is complete and identical to the original block.

What happens to dates and timestamps during conversion? A YAML timestamp is a real date value, and JSON has no date type, so it becomes an ISO date-time string. Confirm it arrived as a quoted string, and remember that code reading it must parse the string back into a date.

What if my YAML file contains duplicate keys? The converter treats duplicate keys as an error instead of silently keeping one value. Decide which value is correct, remove the other, and convert again.

Is my YAML uploaded to a server for conversion? No. The converter uses js-yaml and runs fully locally in your browser, so both the YAML you paste and the JSON it produces stay on your device.

Conclusion

Conversion is the easy half of the job. The check is what turns a plausible-looking JSON file into one you can hand over with confidence: count the keys, trace one branch, confirm the anchors expanded, the timestamps became strings, and the number-looking values carry the types you intended. When the next job runs the other way, converting a spreadsheet export into JSON an app can load, our guide to converting a CSV inventory file to JSON for a mobile app covers that path. For more guides in this series, see our Data and JSON Tools guides.

References