{"id":13564616,"url":"https://github.com/yudai/gojsondiff","last_synced_at":"2025-10-24T18:32:31.707Z","repository":{"id":29745744,"uuid":"33289284","full_name":"yudai/gojsondiff","owner":"yudai","description":"Go JSON Diff","archived":false,"fork":false,"pushed_at":"2023-10-18T02:24:26.000Z","size":3040,"stargazers_count":542,"open_issues_count":25,"forks_count":79,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-12T13:57:33.941Z","etag":null,"topics":["diff","godoc","json","patch"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yudai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2015-04-02T04:31:54.000Z","updated_at":"2025-02-19T07:14:45.000Z","dependencies_parsed_at":"2024-01-16T18:58:10.270Z","dependency_job_id":"fb727879-cc4c-4c06-8f0d-117f82c6c5b0","html_url":"https://github.com/yudai/gojsondiff","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yudai%2Fgojsondiff","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yudai%2Fgojsondiff/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yudai%2Fgojsondiff/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yudai%2Fgojsondiff/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yudai","download_url":"https://codeload.github.com/yudai/gojsondiff/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254159194,"owners_count":22024558,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["diff","godoc","json","patch"],"created_at":"2024-08-01T13:01:33.692Z","updated_at":"2025-10-24T18:32:31.639Z","avatar_url":"https://github.com/yudai.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# Go JSON Diff (and Patch)\n\n[![Wercker](https://app.wercker.com/status/00d70daaf40ce277fd4f10290f097b9d/s/master)][wercker]\n[![GoDoc](https://godoc.org/github.com/yudai/gojsondiff?status.svg)][godoc]\n[![MIT License](http://img.shields.io/badge/license-MIT-blue.svg)][license]\n\n[wercker]: https://app.wercker.com/project/bykey/00d70daaf40ce277fd4f10290f097b9d\n[godoc]: https://godoc.org/github.com/yudai/gojsondiff\n[license]: https://github.com/yudai/gojsondiff/blob/master/LICENSE\n\n## How to use\n\n### Installation\n\n```sh\ngo get github.com/yudai/gojsondiff\n```\n\n### Comparing two JSON strings\n\nSee `jd/main.go` for how to use this library.\n\n\n## CLI tool\n\nThis repository contains a package that you can use as a CLI tool.\n\n### Installation\n\n```sh\ngo get github.com/yudai/gojsondiff/jd\n```\n\n### Usage\n\n#### Diff\n\nJust give two json files to the `jd` command:\n\n```sh\njd one.json another.json\n```\n\nOutputs would be something like:\n\n```diff\n {\n   \"arr\": [\n     0: \"arr0\",\n     1: 21,\n     2: {\n       \"num\": 1,\n-      \"str\": \"pek3f\"\n+      \"str\": \"changed\"\n     },\n     3: [\n       0: 0,\n-      1: \"1\"\n+      1: \"changed\"\n     ]\n   ],\n   \"bool\": true,\n   \"num_float\": 39.39,\n   \"num_int\": 13,\n   \"obj\": {\n     \"arr\": [\n       0: 17,\n       1: \"str\",\n       2: {\n-        \"str\": \"eafeb\"\n+        \"str\": \"changed\"\n       }\n     ],\n+    \"new\": \"added\",\n-    \"num\": 19,\n     \"obj\": {\n-      \"num\": 14,\n+      \"num\": 9999\n-      \"str\": \"efj3\"\n+      \"str\": \"changed\"\n     },\n     \"str\": \"bcded\"\n   },\n   \"str\": \"abcde\"\n }\n```\n\nWhen you prefer the delta format of [jsondiffpatch](https://github.com/benjamine/jsondiffpatch), add the `-f delta` option.\n\n```sh\njd -f delta one.json another.json\n```\n\nThis command shows:\n\n```json\n{\n  \"arr\": {\n    \"2\": {\n      \"str\": [\n        \"pek3f\",\n        \"changed\"\n      ]\n    },\n    \"3\": {\n      \"1\": [\n        \"1\",\n        \"changed\"\n      ],\n      \"_t\": \"a\"\n    },\n    \"_t\": \"a\"\n  },\n  \"obj\": {\n    \"arr\": {\n      \"2\": {\n        \"str\": [\n          \"eafeb\",\n          \"changed\"\n        ]\n      },\n      \"_t\": \"a\"\n    },\n    \"new\": [\n      \"added\"\n    ],\n    \"num\": [\n      19,\n      0,\n      0\n    ],\n    \"obj\": {\n      \"num\": [\n        14,\n        9999\n      ],\n      \"str\": [\n        \"efj3\",\n        \"changed\"\n      ]\n    }\n  }\n}\n```\n\n#### Patch\n\nGive a diff file in the delta format and the JSON file to the `jp` command.\n\n```sh\njp diff.delta one.json\n```\n\n\n## License\n\nMIT License (see `LICENSE` for detail)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyudai%2Fgojsondiff","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyudai%2Fgojsondiff","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyudai%2Fgojsondiff/lists"}