Scenario: I want a function that compares two JSON-objects, and returns a JSON-object with a list of the differences and if possible more data such as coverage metrics.
var madrid = '{"type":"team","description":"Good","trophies":[{"ucl":"10"}, {"copa":"5"}]}';
var barca = '{"type":"team","description":"Bad","trophies":[{"ucl":"3"}]}';
If i ran compare(madrid, barca)
the returned object could look something like:
{"description" : "Bad", "trophies":[{"ucl":"3"}, {"copa":"5"}]};
Or something similar, you get the idea.
Does anyone know of a solution to this? I've already found one plugin, but I'd like to know if there are any alternatives.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…