Developer Tools

Convert JSON and YAML without silently rounding numbers

Convert JSON and YAML with large integers, precise decimals and string IDs. Check the expected output and learn what downstream parsers may change.

The problem: a valid number can change after parsing

A long account reference may look like a number but function as an identifier. If another program rounds it, a clean-looking conversion can identify the wrong record. JSON permits number tokens larger than JavaScript’s exactly representable integer range; the receiving software still determines how those tokens are interpreted. The JSON standard explains this interoperability limit.

The converter below keeps supported numeric tokens as text in its internal syntax tree instead of first turning every number into a JavaScript Number. This protects the conversion step. It cannot force the next application to retain the same precision.

Try a large integer, a decimal and an identifier

  1. Open JSON ↔ YAML Converter and select JSON → YAML.
  2. Paste the JSON input below, then convert it.
  3. Check that 9007199254740993, 1.2300 and the string "00123" retain their written values.
  4. Use Swap, convert back to JSON and compare the value tokens with the expected result.
JSON input
{
  "recordId": 9007199254740993,
  "price": 1.2300,
  "postalCode": "00123"
}
Expected YAML
"recordId": 9007199254740993
"price": 1.2300
"postalCode": "00123"
Expected JSON after converting back
{
  "recordId": 9007199254740993,
  "price": 1.2300,
  "postalCode": "00123"
}

Whitespace and indentation can change. A preserved number token is also not a promise that a database column, spreadsheet or API client will retain the decimal scale 1.2300. If the exact written form is the data, use a string according to the receiving system’s schema.

What this conversion deliberately rejects

JSON has fewer data types than YAML. This converter rejects duplicate keys, YAML aliases, non-string mapping keys, unsupported custom tags and non-finite values such as .nan. It does not silently flatten them into a different meaning. The input limit is 5 MiB of UTF-8 text, with a nesting limit of 100 and 200,000 values or nodes.

A rejected document may still be valid YAML. Use YAML Validator to check YAML syntax separately, then simplify features that the target JSON format cannot represent. The converter follows the YAML 1.2 specification and uses a restricted JSON-compatible conversion policy.

A practical handoff check

Test one real record in the receiving application before converting an entire dataset. Compare large identifiers, empty strings, null, booleans and Unicode text. Keep a copy of the original file and confirm the destination schema, rather than judging success only by whether the output parses.