json patch c# call api code example
Example 1: rest api c# json patch
JsonPatchDocument<SimpleDTO> patchDoc = new JsonPatchDocument<SimpleDTO>();
patchDoc.Add<int>(o => o.IntegerList, 4, 0);
patchDoc.Add<int>(o => o.IntegerList, 5);
patchDoc.Remove<string>(o => o.StringProperty);
patchDoc.Remove<int>(o => o.IntegerList, 2);
patchDoc.Replace<string>(o => o.StringProperty, "B");
patchDoc.Replace<int>(o => o.IntegerList, 5, 4);
patchDoc.Copy<int>(o => o.IntegerValue, o => o.IntegerList, 0);
patchDoc.Move<int>(o => o.IntegerList, 0, o => o.IntegerList, 1);
Example 2: rest api c# json patch
[
{ "op": "add", "path": "/foo", "value": "bar"},
{ "op": "replace", "path": "/baz", "value": "boo" }
]