Appearance
Merge Method
Definition
- Namespace:
JASE.Serializers - Assembly:
JASE.Serializers.dll
string Merge(string original, string transformJson)
csharp
string Merge(string original, string transformJson)Merges a transform JSON into an original JSON, applying transformations such as adding or replacing properties.
Parameters
| Name | Description |
|---|---|
original | The original JSON string to be transformed. Must be valid JSON after comment removal. |
transformJson | The transform JSON string containing properties to add, replace, or remove (null values indicate removal). |
Returns
A formatted JSON string representing the merged result.
Remarks
This method removes comments (//) from both JSON inputs using UncommentJson, then merges the transform JSON into the original.
- Properties in
transformJsonoverwrite or add to those inoriginal. - Properties with null values in
transformJsonare removed fromoriginal. - Nested objects are merged recursively.
- Arrays in
transformJsonreplace arrays inoriginal. The output is formatted with indentation for readability.