Closed wessport closed 5 years ago
One format that works with daff is ndjson with unnested hashes. For example, comparing:
thing1.ndjson
{"t": "t1", "branch": "branch1", "name": "Jane", "number": "14"}
{"t": "t1", "branch": "branch2", "name": "Jane", "number": "14"}
{"t": "t2", "branch": "branch1", "name": "John", "number": "55"}
{"t": "t2", "branch": "branch2", "name": "John", "number": "88"}
thing2.ndjson
{"t": "t1", "branch": "branch1", "name": "Wes", "number": "12"}
{"t": "t1", "branch": "branch2", "name": "Jane", "number": "14"}
{"t": "t2", "branch": "branch1", "name": "John", "number": "55"}
{"t": "t2", "branch": "branch2", "name": "John", "number": "88"}
Gives:
@@,name ,number,branch ,t
→ ,Jane→Wes,14→12 ,branch1,t1
But it doesn't have logic for comparing arbitrary json.
@paulfitz thank you for the explanation! I'll continue the flattening approach then. Thanks!
Hello!
I'm trying to compare two json files, but I keep encountering the following error:
I've put together two example json files in the same format as the files I'm working with:
test1.json
test2.json
I've attempted different json formats which all result in the same error.
Beginner here so there's a good chance I'm doing something wrong on my end. I had success by flattening and converting the json to csv files, but it would be nice if I could just work with the raw json files.
Any advice on getting around this error would be much appreciated! Awesome library by the way!