{"title":"Inspect an API JSON Response Before Repairing It","excerpt":"A two-pane JSON inspection for failing API assertions, with the limits of formatting and repair explained.","canonicalUrl":"https://automationtester.in/blog/tools-reviews/inspect-api-json-before-repairing","category":{"name":"Tools & Reviews","slug":"tools-reviews"},"tags":["json","api-testing","debugging"],"author":{"name":"Shashank Rawlani","url":"https://shashank.rawlani.com","linkedin":"https://www.linkedin.com/in/shashankrawlani/"},"datePublished":"2026-11-15T05:30:00.000Z","dateModified":"2026-11-15T05:30:00.000Z","coverImage":{"url":"https://ik.imagekit.io/automationtester/automationtester-in/blog/covers/v3/inspect-api-json-before-repairing.webp","alt":"One green compact payload in a left pane passes into a right pane as four separated green field rows; an orange malformed branch stops at a crossed-out marker between them."},"contentHtml":"<p>Paste a captured response into the <a href=\"https://automationtester.in/tools/json-formatter\">JSON Formatter</a>, format it, and inspect the tree before changing an assertion. The two panes help you keep the original visible while you examine a copy. Formatting changes whitespace; it does not establish that the response matches an API contract.</p>\n\n<p>An API test fails while the response body is one long line. Before rewriting the expected object, make the payload readable and check what the server actually returned.</p>\n\n<h2 id=\"json-two-panes\">Keep the capture beside the readable copy</h2>\n<p>Replace the left sample with <code>{\"status\":\"paid\",\"total\":499}</code>. The live editor offered to format that compact text. Press <strong>Copy Left to Right</strong> and the right tree shows <code>status: paid</code> and <code>total: 499</code>. The left pane remains the original one-line input. You can switch either editor between text, tree, and table views; the format and compact controls belong to the editor menu.</p>\n<p>For a larger response, search for the failing field in the tree, then copy its exact path and value into the test failure note. If you need to compare two valid responses structurally, use <a href=\"https://automationtester.in/tools/json-diff\">JSON Diff</a>; this workspace is for inspecting and editing a document, not for deciding which paths changed.</p>\n\n<h2 id=\"json-repair-warning\">Repair needs a second look</h2>\n<p>The editor exposes a repair action. Treat repaired output as a proposed edit. A missing comma is often obvious; a truncated string or an unexpected duplicate key is not. RFC 8259 says object names should be unique and notes that receivers handle duplicates differently. A pretty-printed result can therefore hide an interoperability problem if you accept a repair without checking the raw response.</p>\n<p>The pane accepts JSON text, not an HTTP exchange. It cannot tell whether <code>499</code> is cents, a quantity, or an incorrect business value. Keep the status code, headers, and request ID with the body when you investigate a production or CI failure.</p>\n\n<h2 id=\"json-apply\">Capture the field that matters</h2>\n<p>Paste one failing response, copy it to the right, and inspect the field your assertion targets. Record both the raw fragment and the readable value. If the document does not parse, save the original before using repair, then reproduce the malformed response at the API boundary.</p>\n\n<h2 id=\"json-sources\">References</h2>\n<ul><li><a href=\"https://www.rfc-editor.org/rfc/rfc8259\">RFC 8259, JSON</a>: whitespace, valid values, and duplicate object names.</li><li><a href=\"https://automationtester.in/tools/json-formatter\">JSON Formatter</a>: live pane controls and observed copy-to-tree result.</li></ul>"}