I'm using gojs library and I have to record which value was modified.(Like Git commit history)
So, I want to compare JSON and detect which key was changed.
Example Original JSON
{
"key01": {
"key01-01": "val01-01",
"key01-02": "val01-02"
},
"key02": {
"key02-01": 0
}
}
Example Modified JSON
{
"key01": {
"key01-01": "val01-01mod"
},
"key02": {
"key02-01": 0,
"key02-02": 1
"key02-03": {
"key02-03-01": 2
}
}
}
Compare result
["key01"]["key01-01"] -> modified
["key01"]["key01-02"] -> removed
["key02"]["key02-02"] -> added
["key02"]["key02-03"] -> added
["key02"]["key02-03"]["key-02-03-01"] -> added
Is there a good way to implement this function in javascript?