Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 
avatar of Amin Mirzapour

Amin Mirzapour

Amin Mirzapour has asked 0 questions and find answers to 1 problems.

Stats

15
EtPoint
3
Vote count
0
questions
1
answers

About

Checkout my new library:

https://www.nuget.org/packages/JsonDiffer

JSON 1

{
  "name":"John",
  "age":30,
  "cars": {
    "car1":"Ford",
    "car2":"BMW",
    "car3":"Fiat"
  }
 }

JSON 2

{
  "name":"John",
  "cars": {
    "car1":"Ford",
    "car2":"BMW",
    "car3":"Audi",
    "car4":"Jaguar"
  }
 }

Usage


 var j1 = JToken.Parse(Read(json1));
 var j2 = JToken.Parse(Read(json2));

 var diff = JsonDifferentiator.Differentiate(j1,j2);

Result

{
  "-age": 30,
  "*cars": {
    "*car3": "Fiat",
    "+car4": "Jaguar"
  }
}