Build

JSON Formatter — Make a Response Readable and Prove It Is Valid

This indents JSON into something a person can read and tells you whether it is valid, with a position when it is not. Minified JSON is the correct thing to send over the wire and the wrong thing to look at, and a single-line response of several kilobytes is effectively opaque until it has been through here.

When it helps

Two distinct jobs. The first is reading — finding the one field you care about inside a deeply nested response, which is impractical unminified. The second is validating, and that is where it earns its place: a parse error from a client library usually names a character offset and nothing else, while a formatter points at the position and shows you the surrounding structure. Trailing commas, single quotes and unescaped control characters are the usual culprits, and all three are obvious once you can see the shape.

Worth running automatically

Validating structure continuously is more useful than validating it once, because APIs change without telling their consumers. A field renamed, a value that used to be a string arriving as a number, an array that is now an object — none of those change the status code, so every availability check still passes while everything downstream breaks. Asserting on the response body rather than just the status is what catches a contract change on the day it ships.

What you get out of it

Turns an unreadable response into something you can navigate, and a vague parse failure into a specific position. Applied as a scheduled content check, it catches API contract changes that status codes cannot see.

Also in Build