You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: assets/content/cookbook/Introduction/05.AppendingAndMerge.md
+76-10Lines changed: 76 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -171,19 +171,85 @@ We can modify the above data with a document `mods/mymod/_merge/data/songs/myson
171
171
172
172
```jsonc
173
173
[
174
-
{
175
-
"op":"replace",
176
-
"path":"/playData/characters/opponent",
177
-
"value":"monster",
178
-
}, // Replace the value of opponent with monster.
179
-
{ "op":"add", "path":"/playData/characters/girlfriend", "value":"nene" }, // Add a new key girlfriend with the value Nene.
180
-
{ "op":"add", "path":"/playData/difficulties/1", "value":"funky" }, // Add a new value funky to the difficulty array, after easy
181
-
{ "op":"add", "path":"/playData/difficulties/-", "value":"expert" }, // Add a new value expert to the end of the difficulty array.
182
-
{ "op":"remove", "path":"/playData/garbageValue" }, // Remove the key garbageValue from the data entirely
183
-
{ "op":"test", "path":"/playData/garbageValue", "value":37 }, // Test that a given value is in the JSON. If this operation fails, the patches will be rejected.
174
+
// Replace the value of `opponent` with "monster".
This means that you don't have to replace the JSON file to add variations to some songs.
249
+
It's also simply good practice to account for the case that this issue may be true, because it could seriously help with compatibility to metadata files that don't have the variables you need.
250
+
251
+
## Supported Operations
252
+
187
253
The `op`erations supported are `add`, `remove`, `replace`, `move`, `copy`, and `test`. If any operation in a JSON Patch document fails, all of the modifications in that file will be reverted.
188
254
189
255
The `add`, `replace`, and `test` operations require a `value` key (which can be any JSON data, including an array or object), and the `move` and `copy` operations require a `from` key, which is a path value indicating where to move or copy from.
0 commit comments