showing results for - "rest api c 23 json patch"
Yannik
07 Jul 2020
1[
2    { "op": "add", "path": "/foo", "value": "bar"},
3    { "op": "replace", "path": "/baz", "value": "boo" }
4]
5
Chiara
27 Nov 2016
1JsonPatchDocument<SimpleDTO> patchDoc = new JsonPatchDocument<SimpleDTO>();
2
3// add "4" to a list of integers at position 0
4patchDoc.Add<int>(o => o.IntegerList, 4, 0);
5
6// add "5" to the end of that list
7patchDoc.Add<int>(o => o.IntegerList, 5);
8
9// remove the current value of StringProperty
10patchDoc.Remove<string>(o => o.StringProperty);
11
12// remove the value at position two from a list of integers
13patchDoc.Remove<int>(o => o.IntegerList, 2);
14
15// replace StringProperty with value "B"
16patchDoc.Replace<string>(o => o.StringProperty, "B");
17
18// replace value at position 4 in a list of integers with value 5
19patchDoc.Replace<int>(o => o.IntegerList, 5, 4);
20
21//copy value IntegerValue to position 0 in a list of integers
22patchDoc.Copy<int>(o => o.IntegerValue, o => o.IntegerList, 0);
23
24// move the integers at position 0 in a list of integers to position 1 in that same list
25patchDoc.Move<int>(o => o.IntegerList, 0, o => o.IntegerList, 1);