← All posts
1 min read

Clean JSON before you share it with a teammate or an AI tool

A short checklist for formatting, trimming, and redacting JSON so debugging stays fast and private.

JSON is one of the easiest formats to paste and one of the easiest formats to overshare.

Before you drop an API response into a chat, ticket, or AI prompt, take one quiet minute to clean it. You will usually get a better answer, and you reduce the chance of leaking something private.

Step 1: Format it

Minified JSON is hard to scan:

{"status":"failed","error":{"code":"INVALID_URL","message":"Campaign URL is missing a host"}}

Formatted JSON makes the shape visible:

{
  "status": "failed",
  "error": {
    "code": "INVALID_URL",
    "message": "Campaign URL is missing a host"
  }
}

The shape is usually what your teammate needs: which field exists, which one is missing, and where the error sits.

Step 2: Trim unrelated fields

Keep the smallest example that still reproduces the question. Delete huge arrays, repeated objects, and tracking fields that do not change the bug.

Good debugging JSON is not "complete." It is focused.

Step 3: Redact values, not structure

Replace private values with clear placeholders:

  • user@example.com -> user@example.test
  • sk_live_... -> secret_placeholder
  • Real names -> Example User
  • Addresses, phone numbers, and payment data -> remove or replace entirely

Try to keep the key names and data types. A fake string in the same field is much more useful than deleting the field.

Step 4: Validate after editing

Redaction can accidentally break JSON. A missing quote or trailing comma wastes time because everyone starts debugging the example instead of the real issue.

Use the JSON formatter to format and validate the final snippet locally before sharing it.

The best shared JSON is small, valid, and boring. That is exactly why it helps.

Related