One of the tools I rely on for my projects is a Node.js based mock server that helps me specify and mock API responses from the backend. However, it would be beneficial to have a way to ensure both the backend and frontend are in sync with the specified structure. To achieve this, I am looking for a method to compare the JSON Objects' structures.
For instance, these two objects should be deemed as equal:
var object1 = {
'name': 'foo',
'id': 123,
'items' : ['bar', 'baz']
}
var object2 = {
'name': 'bar',
'items' : [],
'id': 234
}
Do you have any suggestions on how I could accomplish this task?