DEV Community

Sadevz Labs
Sadevz Labs

Posted on

JSON Formatting Is Simple. Debugging Bad JSON Isn't.

JSON looks harmless until you're staring at a payload with a missing comma somewhere around line 200.

I've run into this plenty of times while working with APIs, configuration files and backend responses. Usually the problem is tiny:

  • a missing comma
  • an extra comma
  • mismatched brackets
  • single quotes instead of double quotes
  • an unescaped character
  • or simply a giant minified response that's impossible to read
  • The first thing I do: format it

Take something like:

{"user":{"name":"Sam","active":true},"roles":["admin","editor"]}
Enter fullscreen mode Exit fullscreen mode

and turn it into:

{
  "user": {
    "name": "Sam",
    "active": true
  },
  "roles": [
    "admin",
    "editor"
  ]
}
Enter fullscreen mode Exit fullscreen mode

Nothing magical happened, but the structure becomes immediately easier to inspect.

Formatting and validation aren't the same thing

This distinction is easy to overlook.

Formatting makes valid JSON readable.

Validation tells you whether the JSON is actually valid.

If the input contains broken syntax, prettifying it isn't enough. You first need to know where the parser stopped understanding the structure.

So I built the tiny tool I wanted

While building Sadevz Tools, I added a browser-based JSON Formatter & Validator for exactly this workflow.

You can try it here:

https://sadevz.com/json-formatter/

There's no signup or installation. Paste the JSON, work with it, and move on.

I'm gradually building more small browser utilities around the same idea: tools that solve one annoying problem without turning it into a SaaS product.

If you're a developer, I'd be interested to know what feature you consider essential in a JSON utility.

Top comments (0)