Are there any command line utilities that can be used to find if two JSON files are identical with invariance to within-dictionary-key and within-list-element ordering?
Could this be done with jq
or some other equivalent tool?
Examples:
These two JSON files are identical
A
:
{"People": ["John", "Bryan"],"City": "Boston","State": "MA"}
B
:
{"People": ["Bryan", "John"],"State": "MA","City": "Boston"}
but these two JSON files are different:
A
:
{"People": ["John", "Bryan", "Carla"],"City": "Boston","State": "MA"}
C
:
{"People": ["Bryan", "John"],"State": "MA","City": "Boston"}
That would be:
$ some_diff_command A.json B.json$ some_diff_command A.json C.jsonThe files are not structurally identical