SkillAgentSearch skills...

Gojsondiff

Go JSON Diff

Install / Use

/learn @yudai/Gojsondiff
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

Go JSON Diff (and Patch)

Wercker GoDoc MIT License

How to use

Installation

go get github.com/yudai/gojsondiff

Comparing two JSON strings

See jd/main.go for how to use this library.

CLI tool

This repository contains a package that you can use as a CLI tool.

Installation

go get github.com/yudai/gojsondiff/jd

Usage

Diff

Just give two json files to the jd command:

jd one.json another.json

Outputs would be something like:

 {
   "arr": [
     0: "arr0",
     1: 21,
     2: {
       "num": 1,
-      "str": "pek3f"
+      "str": "changed"
     },
     3: [
       0: 0,
-      1: "1"
+      1: "changed"
     ]
   ],
   "bool": true,
   "num_float": 39.39,
   "num_int": 13,
   "obj": {
     "arr": [
       0: 17,
       1: "str",
       2: {
-        "str": "eafeb"
+        "str": "changed"
       }
     ],
+    "new": "added",
-    "num": 19,
     "obj": {
-      "num": 14,
+      "num": 9999
-      "str": "efj3"
+      "str": "changed"
     },
     "str": "bcded"
   },
   "str": "abcde"
 }

When you prefer the delta format of jsondiffpatch, add the -f delta option.

jd -f delta one.json another.json

This command shows:

{
  "arr": {
    "2": {
      "str": [
        "pek3f",
        "changed"
      ]
    },
    "3": {
      "1": [
        "1",
        "changed"
      ],
      "_t": "a"
    },
    "_t": "a"
  },
  "obj": {
    "arr": {
      "2": {
        "str": [
          "eafeb",
          "changed"
        ]
      },
      "_t": "a"
    },
    "new": [
      "added"
    ],
    "num": [
      19,
      0,
      0
    ],
    "obj": {
      "num": [
        14,
        9999
      ],
      "str": [
        "efj3",
        "changed"
      ]
    }
  }
}

Patch

Give a diff file in the delta format and the JSON file to the jp command.

jp diff.delta one.json

License

MIT License (see LICENSE for detail)

View on GitHub
GitHub Stars559
CategoryDevelopment
Updated2mo ago
Forks83

Languages

Go

Security Score

80/100

Audited on Jan 16, 2026

No findings