Questions tagged [deep-diff]

deep-diff is a javascript/node.js module providing utility functions for determining the structural differences between objects and includes some utilities for applying differences across objects.

31 questions
6
votes
2 answers

Construct python dict from DeepDiff result

I have a DeepDiff result which is obtained by comparing two JSON files. I have to construct a python dictionary from the deepdiff result as follows. json1 = {"spark": {"ttl":3, "poll":34}} json2 = {"spark": {"ttl":3, "poll":34, "toll":23}, "cion":…
Srivignesh
  • 337
  • 3
  • 14
4
votes
1 answer

How to exclude "type_changes" completely from deep diff as i only care about value changed?

from deepdiff import DeepDiff t1 = {1:1, 2:2, 3:3} t2 = {1:1, 2:"2", 3:3} print(DeepDiff(t1, t2), indent=2) Output: { 'type_changes': { 'root[2]': { 'new_type': , 'new_value': '2', …
3
votes
1 answer

How to make DeepDiff output human readable?

DeepDiff results look like: {'dictionary_item_added': [root[5], root[6]], 'dictionary_item_removed': [root[4]]} For human review of changes, this only works for small examples. I need something like the code file differences displayed in GitHub…
Aleksandr Levchuk
  • 3,751
  • 4
  • 35
  • 47
3
votes
2 answers

How get different in two object in javaScript

Recently I am working on the project. I am facing the problem in getting the difference between two JavaScript objects. Below are two examples of the object. The Second Object has one extra key. So how to get the difference between the…
Kunal Ingole
  • 93
  • 1
  • 7
2
votes
0 answers

apply changes to a json

so let us suppose i have a json1 = { "accounting" : { "firstName" : "John", "lastName" : "Doe", "age" : 23 }, { "firstName" : "Mary", "lastName" : "Smith", "age" …
A B
  • 31
  • 2
2
votes
1 answer

How to delete specific word from DeepDiff?

I need that code for compate of structure 2-yaml files, And I have some trouble with DeepDiff object. File1: app: mainkey: key1: 60 key2: 5 mainkey2: key1: 120 key2: 5 mainkey3: test: value File2: app: mainkey: key1:…
2
votes
1 answer

Pre-filter condition - deep-diff Node.js

I use the deep-diff Node.js library for comparison of two JSONs. There is also pre-filter condition for omitting few fields for comparison. If my pre-filter condition is multiple attributes, how would I specify that? In the given example, the…
jojo
  • 395
  • 3
  • 14
1
vote
0 answers

Unexpected repetition of dictionary entries using DeepDiff and Delta in Python

I've come across a peculiar issue while working with the deepdiff library in Python. I'm trying to discern the differences between two dictionaries to ultimately generate a delta. Here's the background: I have two dictionaries: d1 = {'a': [{'id':…
Kfir Cohen
  • 43
  • 6
1
vote
2 answers

Python. Compare and merge lists of dictionaries(diversed) by similar items

I have two lists of dictionaries(lod). I want to compare and merge them if they have similar items(by keys 'id' and 'size'), and if not set some default value(0) with certain key('count') to the first lod. lod1 = [{'id':1, 'size':1, 'colour':'a'},…
1
vote
2 answers

Deepdiff Printing all keys if any mismatched

I am using a deepdiff to compare data of two databases. here is example from deepdiff import DeepDiff users1 = [{'id': 1, 'name': 'John', 'age': 30}, {'id': 2, 'name': 'Jane', 'age': 25}] users2 = [{'id': 1, 'name': 'John', 'age': 30}, {'id': 2,…
Sanjay Kumar
  • 145
  • 1
  • 1
  • 10
1
vote
0 answers

deepdiff not calculating difference properly

so while i was working with deepdiff i am facing some issues . while it is working fine on all type of changes most of the time . but some times it is giving an in correct difference . mostly when the attribute. ignore_order= True but this is a…
A B
  • 31
  • 2
1
vote
1 answer

How to get root using DeepDiff

I'm currently working with DeepDiff where I'm trying to figure out how I can get the value of the root instead of printing out the root e.g. Value of root['hello'][0]['hello_world'] changed from "15251" to "51251". So I have made a simple…
PythonNewbie
  • 1,031
  • 1
  • 15
  • 33
1
vote
2 answers

How to compare list of objects and keep only _new_ objects?

I have two JSON files named new and old that files have some data. here I want to compare new.json with the old.json file while comparing if I have the same data in those two JSON files I don't want to create any new JSON file If I have different…
user15047438
1
vote
1 answer

Why do you need deep object comparison?

reference: https://dmitripavlutin.com/how-to-compare-objects-in-javascript/ Following to the reference, deep comparison is: The deep equality is similar to the shallow equality, but with one difference. During the shallow check, if the compared…
shapeless
  • 175
  • 1
  • 10
1
vote
1 answer

DeepDiff on Nested JSON

I would like to find the difference between two JSON but, when I try to use the DeepDiff method it finds nothing. from deepdiff import DeepDiff item1 = { '__PythonResult__Modules': { 'b': { 'c': ['foo'] …
Flo Cp
  • 281
  • 2
  • 13
1
2 3