Can we parse a dynamic JSON to a List of Object List<DiffModel>
public class DiffModel
{
public string Property { get; set; }
public string OldValue { get; set; }
public string NewValue { get; set; }
}
The JSON is generated with the help of a library which helps to compare 2 JSON objects and find out the differences. The differences are getting stored as a JToken
Sample JSON JToken value generated with help of
JToken patch = jdp.Diff(left, right)
method
{
"Id": [
78485,
0
],
"ContactId": [
767304,
0
],
"TextValue": [
"text value",
"text14"
],
"PostCode": [
null
]
}
From the JSON the value of first item in the object is
DiffModel [0] = Property ="id" OldValue="78485" NewValue="0"
DiffModel [1] = Property ="contactId" OldValue="767304" NewValue="0"
DiffModel [2] = Property ="TextValue" OldValue="text value" NewValue="text14"
DiffModel [3] = Property ="PostCode" OldValue= null NewValue=null
Can we navigate between the properties of dynamic JSON and build a similar model