Home PatchExtensions Class
PatchExtensions Class
Cancel

PatchExtensions Class

Namespace: Json.Patch

Inheritance: PatchExtensions 🡒 object

Provides extension methods for Json.Patch.JsonPatch.

Methods

Apply(this JsonPatch patch, T obj, JsonSerializerOptions options)

Apply a patch to an object to transform its data.

Declaration

1
public static T Apply(this JsonPatch patch, T obj, JsonSerializerOptions options)
ParameterTypeDescription
patchJsonPatchThe patch
objTThe object
optionsJsonSerializerOptionsSerializer options.

Returns

New instance of patched object

Apply(this JsonPatch patch, TOriginal obj, JsonSerializerOptions options)

Apply a patch to an object to transform it to another type.

Declaration

1
public static TTarget Apply(this JsonPatch patch, TOriginal obj, JsonSerializerOptions options)
ParameterTypeDescription
patchJsonPatchThe patch
objTOriginalThe object
optionsJsonSerializerOptionsSerializer options.

Returns

New instance of patched object

CreatePatch(this JsonNode original, JsonNode target)

Create JsonPatch from difference between original and target

Declaration

1
public static JsonPatch CreatePatch(this JsonNode original, JsonNode target)
ParameterTypeDescription
originalJsonNodeOriginal object
targetJsonNodetarget object

Returns

JsonPatch

CreatePatch(this TOriginal original, TTarget target, JsonSerializerOptions options)

Creates a Json.Patch.JsonPatch by analyzing the difference between original and target versions.

Declaration

1
public static JsonPatch CreatePatch(this TOriginal original, TTarget target, JsonSerializerOptions options)
ParameterTypeDescription
originalTOriginalThe original object.
targetTTargetThe target object.
optionsJsonSerializerOptionsSerializer options.

Returns

A Json.Patch.JsonPatch that represents the transformation.

Contents