grepyard
All tools

JSON tools

Format, minify, validate, and query JSON with JSONPath. All in your browser — nothing leaves the page.

Valid JSON

$ = root; .foo = child; [*] = all elements; ..foo = recursive descent.

Output

Click Format or Minify.

JSONPath result
[
  "jwt",
  "ja4",
  "regex"
]
§ About this tool

What is JSON?

JSON (JavaScript Object Notation) is a text-based data interchange format derived from JavaScript object literal syntax in 2001 and standardized in RFC 8259. It is the default wire format for nearly every modern web API, the storage format for most configuration files, and the structured-logging format of the past decade of observability tooling.

JSON's strength is being readable to humans and parsable by every language. Its weakness is being just expressive enough to feel like a programming language while omitting features that people then add as ad-hoc dialects (comments, trailing commas, big integers).

How it works

JSON has six value types: objects (string-keyed maps), arrays, double-quoted strings (with \uXXXX escapes for any code point), numbers (no leading zeros, no NaN, no Infinity), booleans, and null. The default character encoding is UTF-8.

JSON is intentionally minimal: no comments, no trailing commas, no date type, no binary type, no reference syntax. Richer needs are met by convention (ISO 8601 strings for dates, Base64 for binary) or by a different format entirely (JSON5, JSONC, BSON, MessagePack).

When to use this tool

  • Pretty-printing a minified API response so it is readable.
  • Validating that a config or payload parses before shipping it.
  • Extracting a subset of a large document via a JSONPath query.
  • Comparing two JSON documents structurally rather than as raw text.
  • Inspecting a structured log line where each entry is a JSON object.

Common pitfalls

  • JavaScript numbers are 64-bit floats. Integers above 253 lose precision silently — a Twitter snowflake ID like 9007199254740993 round-trips through JSON.parse as 9007199254740992. Encode large IDs as strings.
  • Standard JSON has no NaN or Infinity. JSON.stringify(NaN) returns the string "null", dropping the value silently. Filter or coerce special floats before serializing.
  • JSON5 and JSONC (JSON with comments) are different formats. Standard JSON parsers reject comments and trailing commas, so a config that works in VS Code may fail in production deserialization.
  • JSONPath has multiple flavors — Goessner's original, IETF RFC 9535 (2024), and jq's syntax all differ in subtle ways. Selectors that work in one library may not in another.
  • Object keys are unordered by spec, but most parsers preserve insertion order. Code that depends on a specific order is fragile across languages.

Frequently asked

Why doesn't my JSON parse?

The most common causes are a trailing comma after the last element, a single-quoted string, an unquoted key, or a stray comment. Standard JSON allows none of these. Paste the input here to see exactly which position the parser rejects.

How do I include a comment in JSON?

You don't — RFC 8259 forbids them. If you need comments, use JSONC (JSON with comments, used by VS Code config files) or JSON5, and accept that not every parser supports them.

What is JSONPath?

JSONPath is a query language for picking values out of a JSON document. $.users[0].nameselects the first user's name. RFC 9535 standardized one specific dialect in 2024; older libraries follow Stefan Goessner's 2007 informal spec.

What is the difference between JSON and JSON5?

JSON5 is a superset that adds comments, trailing commas, unquoted keys, single-quoted strings, hex numbers, and a few other ergonomic extensions. Browsers and APIs do not accept JSON5 — only standard JSON.

Why is my big integer wrong after a JSON round-trip?

JSON.parse turns numbers into 64-bit floats, which lose precision above 253. Encode large IDs as strings, or use a parser with BigInt support.

§ Related tools