Skip to content

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 ​

NameDescription
originalThe original JSON string to be transformed. Must be valid JSON after comment removal.
transformJsonThe 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 transformJson overwrite or add to those in original.
  • Properties with null values in transformJson are removed from original.
  • Nested objects are merged recursively.
  • Arrays in transformJson replace arrays in original. The output is formatted with indentation for readability.