JSON formatter and validator: questions and guides
Each guide here answers one question with a practical example, then takes you to the tool to try it yourself. Guides: 9.
Questions
- How to format JSON and find the errorHow to turn one-line minified JSON into readable, indented text, and find the exact line and column of the error when the JSON is invalid.
- I copied JSON out of a WhatsApp message or a Word document and now it is invalid even though it looks fine. What happened?Chat apps and word processors swap straight quotes for curly ones that JSON does not accept. How to find the first one by line and column and fix it.
- Why did a price of 45.50 turn into 45.5 after formatting my JSON file? Did the value change?The value did not change: JSON numbers are written back in their shortest form after parsing, so trailing zeros go. When to store a price as text instead.
- The 19-digit order ID in an API response ends in different digits after formatting. How do I keep it intact?JavaScript keeps integers exact only up to 9007199254740991, and anything longer is rounded when rewritten. How the tool warns you, and why IDs belong in strings.
- I have two JSON responses from the same platform with keys in a different order. How can I compare them to see what actually changed?Format both with the same indent and 'Sort keys alphabetically' so keys follow one order at every level, then compare line by line and only real changes remain.
- My JSON file saved from Notepad or Excel fails in another program with an error at the very first character. Why?Some editors save files with an invisible mark at the start called a BOM, and strict JSON readers reject it. How the tool detects it and gives you a clean file.
- The theme settings file I am editing has // and /* */ comments. Why does the validator say it is not valid JSON?Standard JSON has no comments, so the validator stops at the first one. Why the file may still work on your platform, and how to check the data on its own.
- I forgot a closing bracket in the middle of a JSON file. Why does the error point to a later line or to the very end?The parser only notices a missing bracket when it hits something that cannot follow, lines later or at the end of the file. How to read the position backwards.
- I want to paste a JSON value into a Shopify metafield. Should I minify or pretty-print it, and how do I check it is valid before saving?Both forms hold the same data, so minifying is about size and readability, not validity. What matters is that it parses: check it first and watch for duplicate keys.
