I have 2 JSON objects that are deserialized into a c# object
the JSON objects both look like this
{
"obj2": {
"booleanVal": true,
"data": "me",
"foo": {
"Key": "",
"booleanVal": false,
"dataValue": "foo"
},
"Ide": {
"booleanVal": true,
"foo2": {
"booleanVal": false,
"dataValue": "foo"
}
}
}
{
"obj1": {
"booleanVal": true,
"data": "me",
"foo": {
"Key": "",
"booleanVal": false,
"dataValue": "foo"
},
"Ide": {
"booleanVal": true,
"foo2": {
"booleanVal": false,
"dataValue": "foo"
}
}
}
I want to loop through the c# object obj1 check the booleanVal to compare it to the booleanval of obj2, I cant seem to figure out a good way to go through the object to the last nested object the reach the booleanVal, what i tried so far is something like this
private void loop(obj1, obj2)
{
foreach (var p in obj1)
{
foreach (var c in obj2)
{
if (p.booleanVal != c.booleanVal)
{
Console.Error.WriteLine("illegal");
}
}
}
}