Skip to content
OGE logoOGE

Diff Viewer

oge-diff-viewer compares two texts — or two JSON documents — side by side or inline.

A Myers line diff with the changed words highlighted inside changed lines; unchanged runs fold around each change and open on a click. JSON is compared as canonical, key-sorted text, so key order never counts as a change, and the changed paths come back as a list. The toolbar counts what was added and removed, switches the layout and steps through the changes; every changed line says “Added” or “Removed” to a screen reader, not only by colour.

side by side inline word diff JSON

Text

Two versions of a config file: the changed values are highlighted word by word, the unchanged block between the changes folds to one line of context each side. Switch to Inline for one column, or step through the changes with the toolbar.

oldValue newValue mode context
+4−4
BeforeAfter
1 server: 1 server:
2 host: 0.0.0.0 2 host: 0.0.0.0
3 Removed: port: 8080 3 Added: port: 8443
4 Removed: workers: 4 4 Added: workers: 8
5 Added: tls: true
5 logging: 6 logging:
6 Removed: level: info 7 Added: level: warn
7 format: json 8 format: json
13 export: true 14 export: true
14 Removed: beta-dashboard: false

JSON

JSON text on one side and a value on the other, its keys in another order: only the real changes show, and diff().changes lists their paths.

language: json diff().changes sortKeys
+4−3
Before After Comparison
1 1 {
2 2 "name": "Desk lamp",
3 Removed: "price": 39.9,
3 Added: "price": 34.9,
4 4 "sku": "SKU-2041",
5 5 "stock": {
6 6 "store": 8,
7 Removed: "warehouse": 120
7 Added: "warehouse": 96
8 8 },
9 9 "tags": [
10 10 "lighting",
11 Removed: "office"
11 Added: "office",
12 Added: "sale"
12 13 ]
13 14 }
  • changed $.price
  • changed $.stock.warehouse
  • added $.tags[2]