Skip to content

How to Format, Validate, and Debug JSON on a Mac (Without Online Tools)

Published · Updated

**JSON debugging** starts by formatting minified payloads into readable structure, then locating syntax errors against the JSON grammar defined by RFC 8259.

Pasting production payloads into a browser tool can send API secrets, customer PII, and authentication tokens to a third-party web server. Check the tool's data path before using real payloads.

This guide details an offline workflow on macOS to format, validate down to line/column offsets, inspect nested stringified JSON, and query values using JSONPath.

JsonXmlEditor on Mac showing formatted JSON with a readable structure.

Format, validate, and debug JSON on Mac without online tools

  1. Open JSON payload Load local file or paste JSON into native editor.
  2. Pretty-print AST Format single-line JSON into structured indented tree.
  3. Fix line/col errors Resolve RFC 8259 syntax violations using offset markers.
  4. Compare AST diffs Review structural changes side-by-side.
  5. Query with JSONPath Target specific values via JSONPath expressions.
  6. Generate native DTOs Export validated AST into Swift or TypeScript models.

The example: a tiny JSON payload with annoying problems

Consider a minified API response containing common syntax violations:

{
  "user": {
    "id": 42,
    "name": "Maya",
    "email": "maya@example.com",
    "roles": ["admin", "editor",]
  },
  "active": true
  "lastLogin": "2026-07-18T09:30:00Z"
}

This payload contains two structural RFC 8259 violations:

  • Trailing Comma: The roles array contains a trailing comma after "editor".
  • Missing Key Separator: Missing comma after "active": true.

Step 1: Format minified JSON into readable AST structures

Pretty-printing formats minified single-line byte streams into structured token trees.

JsonXmlEditor for macOS detects JSON structures automatically and formats payloads with 2, 4, or 8 space indentation without sending data to web workers.

Step 2: Validate syntax errors down to line and column offsets

Native AST validators parse byte streams and jump directly to error line/column offsets.

Fixing reported trailing commas and missing key separators turns malformed text into valid RFC 8259 JSON:

{
  "user": {
    "id": 42,
    "name": "Maya",
    "email": "maya@example.com",
    "roles": [
      "admin",
      "editor"
    ]
  },
  "active": true,
  "lastLogin": "2026-07-18T09:30:00Z"
}

Step 3: Compare source with validated formatted output

Side-by-side diff views compare raw source bytes with pretty-printed AST output, highlighting structural changes instantly.

Step 4: Recursively unescape nested stringified JSON

Webhook payloads and message queues often embed JSON as escaped string primitives.

JsonXmlEditor auto-detects escaped JSON strings and unescapes nested objects into dedicated tabs for isolated AST inspection.

Step 5: Query values using JSONPath expressions

Instead of manually expanding large object trees, JSONPath expressions extract specific fields:

$.user.email

Or target array elements:

$.user.roles[0]

Step 6: Test API endpoints locally with integrated REST inspector

Test HTTP status codes, headers, and response payloads directly within one sandboxed macOS workspace.

Step 7: Generate native DTO models for Swift, TypeScript, and Python

Convert validated JSON AST trees into strongly typed DTO interfaces for Swift, TypeScript, Go, Java, and Python.

Frequently asked questions

How do I format JSON on a Mac without an online tool?
Open the JSON in JsonXmlEditor for macOS, which formats payloads locally with 2, 4, or 8 space indentation without sending data to external servers.
How do I find line and column offsets for JSON syntax errors?
Native AST validators parse byte streams and display exact line and column markers for trailing commas or missing separators.
Why avoid pasting API responses into online JSON formatters?
Online tools upload your payload to third-party web servers, exposing API tokens, customer PII, and internal URLs. Local Mac apps keep data on your machine.

Sources and further reading