
For the task at hand, the version using keys should be used. POST-POSTSCRIPT: The builtin version of walk has recently been changed so that it no longer sorts the keys within an object. $JQ -r -n -argfile A "$1" -argfile B "$2" -f 1.5, and can therefore be omitted if your jq includes it, but there is no harm in including it redundantly in a jq script. ( )Īnd wrapped up as a bash script: #!/bin/bash Here is a solution using the generic function walk/1: # Apply f to composite entities recursively, and to atoms r def post_recurse: post_recurse(.?) ($a | (post_recurse | arrays) |= sort) as $a | ($b | (post_recurse | arrays) |= sort) as $b | $a = $b' r def post_recurse: post_recurse(.?) (post_recurse | arrays) |= sortĪpplied to the jq invocation above: jq -argfile a a.json -argfile b b.json -n 'def post_recurse(f): def r: (f | select(.

Best and Secure Online JSON Compare Online work well in Windows, Mac, Linux, Chrome, Firefox, Safari, and Edge. This JSON Diff Online tool is very powerful and easy to use tool. It helps to find the different between two json to find the accurate results. This GitHub issue explains why and provides some alternatives, such as: def post_recurse(f): def r: (f | select(. JSON Compare tool to compare two JSON data with ease. | arrays) |= sort construct doesn't actually work as expected on some edge cases. This program should return "true" or "false" depending on whether or not the objects are equal using the definition of equality you ask for.ĮDIT: The (. Assuming your two files are named a.json and b.json, on the latest jq nightly: jq -argfile a a.json -argfile b b.json -n '($a | (. Sorry, can't share the JSON data structure with you either, it may be considered confidential.Since jq's comparison already compares objects without taking into account key ordering, all that's left is to sort all lists inside the object before comparing them. I just need a parser or diff tool that will do what I want.
#Json compare tools code
In terms of a code solution, any language will do.
#Json compare tools manual
Presumably the JSON is either too complex or too large to process.Īny thoughts on best solution? Or might the best solution for now be manual analysis w/ grep for each parameter/property? Came across these:īoth failed to do what I wanted. Or maybe there's some ready made code already for that. Could write code to do it but I'd also have to spend time to do that, and test if the code works also. I could do manual search/grep but that's a pain to cycle through all the parameters inside the smaller JSON. Normal text compare doesn't do much, I'd have to reformat manually or w/ script to break up object w/ newlines, etc. The APIs return the JSON output compressed as a single line.
#Json compare tools windows
One spans a page if you print it out via Windows Notepad. What makes this tougher is the JSON objects are huge. Unfortunately, I don't have the documentation that defines the JSON for each API.

Because I want to eventually use data from one JSON output to construct the other JSON as input to an API call. Actually, I'm more interested in the shared parameters/properties within the object, not really the actual values of the parameters/properties of each object. I want to find all the interesecting data between the two objects. One JSON (the smaller one) is like a subset of the bigger JSON object.

There is intersecting data between the 2 JSON objects, and they share similar JSON structure, but not identical. I have 2 JSON objects (returned from different web service API or HTTP responses). I have a problem I'd like to solve to not have to spend a lot of manual work to analyze as an alternative.
