Skip to content

JSON Diff

Runs in your browser

It compares the data, not the text — so reformatting and reordered keys don't count.

Document A

Document B

2 added, 3 changed

  • ~$.name"Widget" "Widget Pro"
  • ~$.price19.99 24.99
  • +$.tags[2]= "pro"
  • ~$.inStocktrue false
  • +$.discontinued= false

How the structural diff works

ToolJar parses both documents and walks them together: object properties are matched by key regardless of order, and array elements are compared by position (index 0 against index 0, and so on). A property that exists only in A is reported as removed, one that exists only in B as added, and a value present in both but different — including a type change, like a string becoming an object — as changed. Because arrays are compared by index, inserting an element at the start of an array will show every following element as changed rather than being detected as a shift; this is a deliberate trade-off for a diff that's easy to reason about.

Questions

Does key order matter?
No, and that's the point. Objects are matched up by key, so shuffling properties around without changing any values gives you an empty diff — which is exactly what a line-based diff gets wrong.
What about arrays?
Arrays are matched up by position — index 0 against index 0, and so on. That keeps the results predictable, but it does mean inserting an item at the front shows every element after it as changed, rather than as one insertion. Worth knowing before you read a long array diff.

Keyboard shortcuts

Global

  • Show this shortcuts dialogShift?
  • Toggle light / dark themeCtrlShiftL
  • Close dialogsEsc

Formatter & Validator

  • Format JSONCtrlEnter
  • Minify JSONCtrlShiftM
  • Copy outputCtrlShiftC
  • Download output as .jsonCtrlShiftS
  • Clear input and outputCtrlShiftX

Tree Viewer

  • Focus the search box/
  • Expand all nodesCtrlShiftE
  • Collapse all nodesCtrlShiftR

Diff

  • Swap document A and BCtrlShiftS

JSON tools

JSON FormatterPretty-print or minify
JSON ValidatorCheck strict JSON validity
JSON Tree ViewerBrowse JSON as a tree
JSON DiffCompare two documents
JSON Path FinderExplore JSONPath expressions
JSON → CSVFlatten JSON into rows
CSV → JSONTurn rows back into objects

JWT tools

JWT DecoderRead header, payload, claims
JWT VerifierCheck an HMAC signature
JWT Expiry Checkeriat, nbf and exp in local time
JWT GeneratorBuild a signed test token
Base64URL EncoderEncode or decode a segment

Code formatters

SQL FormatterBeautify or minify SQL
HTML FormatterBeautify or minify HTML
CSS FormatterBeautify or minify CSS
JavaScript FormatterBeautify or minify JS
Markdown to HTMLConvert with a live preview

Pages

JSON toolsFormat, validate, compare and convert JSON.
JWT toolsDecode, verify and generate JSON Web Tokens.
Code formattersBeautify and minify SQL, HTML, CSS and JavaScript.
HomePopular tools and categories
All categoriesBrowse tools by category
AboutWhat ToolJar is and why
PrivacyWhat is and is not collected

Theme

Switch to light theme
Switch to dark theme