'How can i compare 2 Json document and find the difference between them in Marklogic using javascript?
How can i compare two Json document's and find the difference between them in Marklogic using javascript?
Solution 1:[1]
To compare 2 JSON Objects, you could just use The following function:
const areTheSame = (foo, bar) => JSON.stringify(foo) == JSON.stringify(bar);
// Example:
areTheSame({foo: 'bar'}, {foo: 'bar'}) // true
EDIT: As i mentionned, you cannot find the difference of 2 Objects... Good Luck!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Ramy Hadid |
