Ignoring a property name within a nested JSON member but not in another nested member if the property name already exists there #1491
-
|
Apologies if this is obvious but given, for example, the following JSON: {
"member1": {
"prop1": "value1"
},
"member2": {
"prop1": "value2"
}
}How might I scrub "prop1" in "member1" but not in "member2"? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
|
try this |
Beta Was this translation helpful? Give feedback.
-
|
Hello. I have a similar problem but where I would like to ignore properties named "id" but only on one level of the json structure. An example json would be: There are actually far more properties named id by the developers, but the top level one can vary depending on when the originating object was created in the database, so is consistently triggering verify mismatches when the test is run by the ci/cd-pipeline. I tried a modification of the above example .IgnoreInstance(_ => _.Path == "listOfData[0].id") but it hasn't worked. Ideally I would want to ignore or scrub all top level id fields of objects contained in listOfData. Also since I'm not an experienced C# programmer but an testautomation engineer with mostly Java experience, I'm wondering which notation is the path "member1.prop1" expressed in? It's not linq? I checked Newtonsoft and Argon documentation but that didn't reveal any answer to this. |
Beta Was this translation helpful? Give feedback.
try this