Back to Blog

    JsonifyTools field guide

    How to Format and Debug JSON API Responses

    Format raw API response JSON, inspect nested fields, and separate JSON parsing problems from HTTP and application errors.

    By JsonifyTools5 min read
    TRACE THE RESPONSE: request → status → body — separate the layersREQUESTGET /users/42200 OKHTTP statusJSON BODYTRACE THE RESPONSErequest → status → bodyseparate the layers
    A diagram illustrating separate the layers.
    Format a response in the Viewer

    From raw response to readable structure

    This is fictional sample data. A real response commonly includes resource data plus metadata such as pagination or a request identifier.

    Raw body

    Compact JSON
    {"status":"ok","data":{"user":{"id":"u_204","displayName":"Avery Chen","preferences":{"emailUpdates":false}},"roles":["editor","reviewer"]},"meta":{"requestId":"req_demo_81","page":1}}

    Readable body

    Formatted JSON
    {
      "status": "ok",
      "data": {
        "user": {
          "id": "u_204",
          "displayName": "Avery Chen",
          "preferences": { "emailUpdates": false }
        },
        "roles": ["editor", "reviewer"]
      },
      "meta": { "requestId": "req_demo_81", "page": 1 }
    }

    What to inspect

    status
    Application-level indicator in this example, not the HTTP status code.
    data.user.preferences.emailUpdates
    Nested boolean preference; false is a real value, not a missing field.
    data.roles[0]
    The first string in the roles array.
    meta.requestId
    A safe example correlation ID that support logs might use.

    A request-to-response debugging loop

    1. 1Check request and HTTP status
    2. 2Inspect and parse the body
    3. 3Compare fields with the contract
    RequestHTTP status + headersJSON body → inspect fields

    A formatted JSON body answers only part of the debugging question. Record the HTTP status and relevant headers separately. A server can return a valid JSON error body with status 401 or 500; conversely, a successful 200 response can contain data your client does not handle correctly.

    Separate parsing, HTTP, and application problems

    LayerQuestionExample clue
    Transport / HTTPDid the server return the expected status?401, 404, 500; inspect headers and endpoint
    JSON syntaxCan the body be parsed?Unexpected token, invalid escape, truncated body
    Application contractAre required fields and types present?Expected array but received null

    A practical checklist

    1. Capture the status code and endpoint; redact private query parameters.
    2. Check whether the response body is complete and whether it parses as JSON.
    3. Format it, then trace the field path your client reads.
    4. Compare actual keys and types against the API contract or schema.
    5. Check optional and nullable fields before accessing nested properties.
    6. Use the request ID to correlate server logs when the response includes one.

    Compare the response with what the client expects

    When a request succeeds but a screen is missing data, inspect the field path used by the client and compare it with the actual response. Confirm whether the API wrapped the resource in data, renamed a key, changed an array to a single object, or returned null for a value that used to be present. The browser’s network panel and a saved fixture make it easier to compare two responses without guessing from the UI alone.

    A schema or API contract can check expected field names and types after parsing. It still cannot decide whether a particular status is acceptable for a user flow. For example, a 404 body can be valid JSON and match an error schema, yet the request may point to the wrong resource. Keep transport, syntax, and application checks as separate steps so each points toward the right fix.

    For paginated endpoints, inspect the paging fields as well as the current records. A response containing an empty data array may mean there are no matches, that the requested page is beyond the end, or that a filter was too narrow. Check the documented meaning of fields such as nextCursor or hasMore before treating an empty page as a server failure.

    Paste a response into the JSON Viewer to format it and explore its tree. The API Tester can send requests and display response details. For a nested-data refresher, see how to read complex JSON.