JSON · Dialects 3 min read ·

Formatting Fastjson Logs & Non-Standard JSON (@type, Numeric Keys & Comments)

Copied a Fastjson snippet with @type, numeric keys, Set[...], or single quotes from server logs and hit red syntax errors? Here is how to inspect and normalize it cleanly.

Why Server Log Snippets Fail Strict RFC 8259 Validation

RFC 8259 JSON strictly requires double-quoted keys and strings, and forbids comments, trailing commas, numeric suffixes (123L), or constructor literals. Real-world Java logs (especially Fastjson with WriteClassName or Map<Long, Object>) and console dumps routinely include all of them.

Typical Fastjson / backend log payload
json
{
  "@type": "com.example.order.OrderSnapshot",
  1001: {
    'sku': 'SKU-9001',
    tags: Set['vip', 'express'], // set literal & single quotes
    expireAt: 1765000000000L,
  },
}

Preserve Dialects for Triage vs. Normalize for Downstream APIs

During incident investigation you want readable indentation without losing @type hints or comments. When replaying requests in Postman or saving into a config center, you need clean RFC 8259 JSON.

  • Native dialect support: ITGrocery Fmt recognizes Fastjson @type/@ref/$ref, numeric Map keys, Set[...]/TreeSet[...], new Date(...), L/D/F/S/B suffixes, and comments as valid inputs.
  • Fault-tolerant autofix: Trailing commas, broken quotes, or full-width punctuation are highlighted by line/column with a live right-hand autofix preview.
  • Escaped log strings: Payloads wrapped like "{\"code\":200}" can be decoded in one click with the Unescape button.

Locate Deep Fields Instantly with Path Tree

For multi-thousand-line payloads, switch the output pane to Path Tree, filter by keyword (e.g. orderId or hikari), and click any node to copy dot notation or standard JSONPath.

Normalized RFC 8259 output ready for API replay
json
{
  "1001": {
    "sku": "SKU-9001",
    "tags": ["vip", "express"],
    "expireAt": 1765000000000
  }
}

Practical Log-Triage Checklist

  • Use the Unescape toggle first whenever a log payload is wrapped in quotes with escaped \" characters.
  • Keep dialect formatting during diagnosis; normalize to strict double-quoted JSON before sending to APIs.
  • Use Path Tree to copy exact JSONPath expressions for assertions and log parsers.

Format Fastjson & Escaped Logs Locally

Native Fastjson dialect compatibility, one-click Unescape, autofix diff preview, and Path Tree search.

Open JSON Tool

Related Local Tools

More Troubleshooting Guides

All Guides →