{"id":20801901,"url":"https://github.com/philips-software/compare-json-arrays-in-files","last_synced_at":"2026-04-25T19:31:31.766Z","repository":{"id":42393657,"uuid":"216800674","full_name":"philips-software/compare-json-arrays-in-files","owner":"philips-software","description":"Compares the contents of two JSON arrays as read from input files. Outputs the common elements and the elements representing the deltas (to three output files), taking into consideration that:  (1) the order of keys may differ between elements  (2) the order of elements to be compared may be different between files","archived":false,"fork":false,"pushed_at":"2023-10-16T17:51:01.000Z","size":702,"stargazers_count":2,"open_issues_count":9,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-12T02:47:11.504Z","etag":null,"topics":["software-bill-of-materials"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/philips-software.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-10-22T11:47:37.000Z","updated_at":"2022-04-16T22:39:22.000Z","dependencies_parsed_at":"2025-01-18T12:39:15.534Z","dependency_job_id":null,"html_url":"https://github.com/philips-software/compare-json-arrays-in-files","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/philips-software/compare-json-arrays-in-files","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philips-software%2Fcompare-json-arrays-in-files","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philips-software%2Fcompare-json-arrays-in-files/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philips-software%2Fcompare-json-arrays-in-files/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philips-software%2Fcompare-json-arrays-in-files/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/philips-software","download_url":"https://codeload.github.com/philips-software/compare-json-arrays-in-files/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philips-software%2Fcompare-json-arrays-in-files/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32274982,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-25T18:29:39.964Z","status":"ssl_error","status_checked_at":"2026-04-25T18:29:32.149Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["software-bill-of-materials"],"created_at":"2024-11-17T18:25:27.139Z","updated_at":"2026-04-25T19:31:31.753Z","avatar_url":"https://github.com/philips-software.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Compare-Json-Arrays-In-Files\n\n\u003e Note: :warning: If you're interested in Software Bill of Materials, you might also look into [Bompare](https://github.com/philips-labs/bompare)\n\n### Description\nCompares the contents of two JSON files as provided in the command line.\n\nOutput is three json files, containing common elements and deltas:\n  - _commonElements.json_, contains the elements common to both file in the left as well as the one in the right\n  - _elementsInLeftOnly.json_: contains the elements which are only found in the left file \n  - _elementsInRightOnly.json_: contains the elements which are only found in the right file \n\n__Note__: contents of these output files is sorted as follows:\n  - keys in each element of the array are sorted alphabetically\n  - elements in the array are sorted by their string representation.\n\n### Why was this needed?\nUnlike other tools that provide a diff-like view in one file, and instead of comparing the contents of files side-by-side using a diff text tool, Compare-Json-Arrays-In-Files provides a clear overview of the common parts and deltas (to three output files), taking into consideration that the order of elements to be compared may be different between files.\n\nThus, if the left file would contain:\n```\n[\n  {\"letter\": \"A\", \"digit\": \"1\"},\n  {\"letter\": \"B\", \"digit\": \"2\"},\n  {\"letter\": \"C\", \"digit\": \"3\"}\n]\n```\n\nand the right one would contain:\n```\n[\n  {\"digit\": \"1\", \"letter\": \"A\"},\n  {\"digit\": \"3\", \"letter\": \"C\"},\n  {\"letter\": \"B\", \"digit\": \"2\"}\n]\n```\n\nthen Compare-Json-Arrays-In-Files would conclude that the files have the same JSON contents.\n\nIt outputs at one glance, in the console output:\n  - a comparison of the number of elements read from each of the input files\n  - a high-level comparison based on the contents, i.e. #elements that are common, #elements that are found only in the left file, #elements were only found in the right file.\n  - names of the output files\nThis overview is very useful especially when the two files contain hundreds or more elements.\n\n### Status\nv1.0.0, see [CHANGELOG.md](./CHANGELOG.md)\n\n### Limitations\n- currently only supporting flat JSON objects (no nested structures)\n\n### Prerequisites\n- you should have Node installed (this script was tested with node v12.2.0)\n- you should have yarn installed (we used version v1.19.0)\n\n### How to run\n```\nyarn compareJsonFiles [options] \u003cleftFile\u003e \u003crightFile\u003e\n```\n#### Mandatory arguments:\n| Arguments       | Functionality\n| --------------- | ---------------------------------------------\n| leftFile        | Left input .json filename used in comparison\n| rightFile       | Right input .json filename used in comparison\n\n#### Supported options:\n| Flag              | Alias | Functionality\n| ----------------- |:-----:| -------------------------------------\n| --verbose         |       | Verbose output of commands and errors\n| --help            | -h    | Help      \n| --version         | -v    | Version\n\n#### Sample usage\n```\nyarn compareJsonFiles ./testData/fileWithABC.json ./testData/fileWithBCD.json --verbose\n```\n\n## Technology stack\n- Javascript\n- This software is intended to be used standalone, as a command-line tool\n\n## How to build\nGet the sources locally; in a command line, go to the root folder of this project and execute:\n```\nyarn install\n```\n\n## How to test\n```\nyarn test\n```\nor, to get the coverage:\n```\nyarn coverage\n```\n## How to do static analysis of code\n__Automatically enabled: standard__\n```\nyarn lint\n```\n\n## Owners\nSee [CODEOWNERS](./CODEOWNERS)\n\n## Maintainers\nSee [MAINTAINERS.md](./MAINTAINERS.md)\n\n## Contributing\nSee [CONTRIBUTING.md](./CONTRIBUTING.md)\n\n## License\nSee [LICENSE.md](./LICENSE.md)\n\n## Keywords\n  - json arrays comparer\n  - json arrays delta \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphilips-software%2Fcompare-json-arrays-in-files","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphilips-software%2Fcompare-json-arrays-in-files","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphilips-software%2Fcompare-json-arrays-in-files/lists"}