Table of Contents

Class JsonMerger

Namespace
PolyMod.Json
Assembly
PolyMod.dll

The merge of a JSON patch into a JSON object, for example a GLD patch into the game logic data.

public static class JsonMerger
Inheritance
JsonMerger
Inherited Members

Remarks

Objects merge recursively. A value in the patch replaces the value in the original, and a null value in the patch sets the value to null.

Arrays have special rules. A string that starts with + adds the string without the + to the original array. A string that starts with - removes all equal strings from the original array. In an array with the name skins, a plain string also adds the string. If an array has none of these items, the patch array replaces the original array. If an array has some of these items, the merge ignores the other plain strings in it.

Methods

Merge(JObject, JObject)

Merges a patch into an original JSON object. The method changes original and patch.

public static JObject Merge(JObject original, JObject patch)

Parameters

original JObject

The JSON object to change.

patch JObject

The JSON object with the changes.

Returns

JObject

The original object, after the merge.