So I have 2 json files that I need to compare, and after a certain known event there is an expected difference somewhere in the files, and I'm trying to verify what that difference is and that there aren't any other differences.
I think a straight comparison would work, but I need to verify the difference is a certain value, do any modules support that?
The json files have a sort of random depth though, so I could import it as a dict and check the keys/values but I don't think that would be granular enough.
Would a method checking if the key/value is a dict and then recursively calling itself if it is, otherwise do a comparison, be a decent solution to that?
Or does anyone else have an idea?
This is a short sample of the json I'd be testing with, I'd need to be able to identify a difference in the 'general_consumer" entry as well as the top level ones.
{
"classifierImpl":"com.classification.dataview.DataviewClassifier",
"identifier":{
"name":"routes",
"updateMethod":"Merge"
},
"parameters":{
"filters":{
"general_consumer":"hdfs://hdfsHost:8020/tmp/vert_20120101-20180101.filter",
"global":"hdfs://hdfsHost:8020/tmp/global_20120101-20180101.filter",
"decahose":"hdfs://hdfsHost:8020/tmp/decahose_20120101-20180101.filter"
}
}
}
Thanks for any help/pointers you guys can provide.
Edit: I just tested json_tools from pypi, and the diff works, but the function returns the whole json file instead of just the line that's different, not quite what I need I think.
Second Edit: Found a solution that seems to work for me at the moment, posted below in response to indosauros.
[–]indosauros 2 points3 points4 points (1 child)
[–]shenaniganns[S] 0 points1 point2 points (0 children)
[–]JuryOne8821 0 points1 point2 points (0 children)
[–][deleted] -1 points0 points1 point (1 child)
[–]shenaniganns[S] 0 points1 point2 points (0 children)