{"id":13587429,"url":"https://github.com/jlevy/pdiffjson","last_synced_at":"2025-09-21T06:32:40.729Z","repository":{"id":57321564,"uuid":"255493471","full_name":"jlevy/pdiffjson","owner":"jlevy","description":"View and diff JSON the easy way","archived":false,"fork":false,"pushed_at":"2021-10-17T20:51:17.000Z","size":283,"stargazers_count":72,"open_issues_count":3,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-03-14T22:24:27.141Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jlevy.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}},"created_at":"2020-04-14T02:45:05.000Z","updated_at":"2024-03-13T16:02:48.000Z","dependencies_parsed_at":"2022-08-25T22:41:37.594Z","dependency_job_id":null,"html_url":"https://github.com/jlevy/pdiffjson","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/jlevy%2Fpdiffjson","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jlevy%2Fpdiffjson/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jlevy%2Fpdiffjson/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jlevy%2Fpdiffjson/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jlevy","download_url":"https://codeload.github.com/jlevy/pdiffjson/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":233723960,"owners_count":18720110,"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":[],"created_at":"2024-08-01T15:06:12.561Z","updated_at":"2025-09-21T06:32:35.432Z","avatar_url":"https://github.com/jlevy.png","language":"Shell","funding_links":[],"categories":["Shell"],"sub_categories":[],"readme":"# pjson and pdiffjson\n\n- **Just the simplest and fastest way to format, display, and diff JSON directly from the\n  command line.** Not a fancy web UI or a library.\n- [`pjson`](pjson) and [`pdiffjson`](pdiffjson) are simple bash scripts that are useful (and non-obvious) enough more\n  developers should have them at their fingertips.\n  They combine `jq`, `diff`, `colordiff`, and `less` to normalize, display, and diff JSON. Once you have them\n  handy, you may find yourself using them a lot.\n- `pjson` normalizes, colorizes, and displays one file or stdin.\n- `pdiffjson` normalizes and displays a colorizied diff of any two files.\n- Display and diff both ignore all non-semantic differences in formatting and whitespace.\n  Only significant differences are shown in the diff output.\n- The ordering of keys on collections objects is always ignored (as it should be!)\n  by sorting keys.\n  There’s an option to sort arrays, too, to allow unordered comparison of lists.\n- Works on large files other tools barf on, thanks to `jq`’s speed.\n- Diff shows context around each change, thanks to `diff`.\n- Scrollable and searchable output (use space, `/`), thanks to `less`.\n- Installs quickly anywhere, thanks to `npm`.\n- *The feature list is longer than the code!*\n  🤯😀\n\n![example usage](images/example.gif)\n\n## Installation\n\n1. Ensure you have `jq` and `colordiff` on your system.\n\n   Use `brew install jq colordiff` on Mac, `apt-get install jq colordiff` or equivalent on Linux.\n\n2. Install the script anywhere you like.\n   Simplest:\n\n   ```bash\n   $ npm install -g pdiffjson\n   ```\n\n   Or copy `pjson` and `pdiffjson` to `/usr/local/bin` by hand!\n\n## Usage\n\n```\n$ pdiffjson\nUsage: pdiffjson [--sort-arrays] [diff options] file1.json file2.json\n\nShow pretty-printed, colored diff of normalized JSON. Uses less to\npaginate the output. Allows a readable diff of any JSON, ignoring all\nnon-semantic differences of whitespace and key ordering.\n\nFields of each object are output with the keys in sorted order\nprior to calling diff, so insignificant differences of key order\nare ignored. The --sort-arrays option also enables recursive sorting\nof all array values, so all differences in ordering within arrays\nare ignored.\n\nThis is a \"semi-structural diff\", meaning it shows only structural\n(semantic) changes but the diff is shown syntactically on JSON output,\nwhich actually makes it more readable and flexible than a true\nstructural diff.\n\nWorks on large files since it relies only on diff and jq.\n\nBy default calls diff without arguments, yielding a unified diff. But\nit can be helpful to add standard diff arguments to refine the type of\noutput, such as:\n-c (contextual diff),\n-C2 (contextual diff with two lines of context), or\n-U5 (unified diff with 5 lines of context).\n\n$\n```\n\n## Related Work\n\n- [Many websites](https://www.google.com/search?q=json+diff) like\n  [jsondiff](https://github.com/zgrossbart/jdd) offer JSON diff functionality but offer no\n  command line, don’t work on large files, and are not good for sensitive data.\n- [jsondiffpatch](https://github.com/benjamine/jsondiffpatch) is a powerful JavaScript library\n  to do JSON diff and patch.\n  Has a command line.\n  Shows a pure structural diff.\n  No semi-structured diff with context.\n- [diff-json](https://github.com/andreyvit/json-diff) is another useful JavaScript library with\n  a command-line interface.\n  Rather slow on larger (multi-megabyte) files, with no incremental output.\n- [jd](https://github.com/josephburnett/jd) is a powerful Go command line tool.\n  It handles diff and patching.\n  It allows more flexible diffs options on arrays (set and bag).\n  No colored output or diff output options to show more context, as with diff, so the output\n  seems less clear to read.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjlevy%2Fpdiffjson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjlevy%2Fpdiffjson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjlevy%2Fpdiffjson/lists"}