Similar Question:
Object comparison in JavaScript
Is there a way to compare two JSON objects and identify any differences in the data they contain?
Update
After going through the feedback, some additional details are required.
A JSON object is described as
"an unordered set of name/value pairs. An object starts with { (left brace) and ends with } (right brace). Each name is followed by : (colon) and the name/value pairs are separated by , (comma)." -- json.org
What I aim to do is simply compare two JSON object literals.
Not being an expert in JavaScript, if these are referred to as object literals in JavaScript, then that's the term I should use.
I think what I need is a method that can:
- Perform deep recursion to detect unique name/value pairs
- Determine the length of both object literals, and check for discrepancies in the name/value pairs between them.