JSON Patch

I don’t know JsonPatch before reading this post from Ben Foster.

It’s a normalized way (RFC 6902) of specifying, in json format, patch to a json document. You write operations for add, removereplace, copy, move and test.

Main use is for reduce http request size (using http PATCH) but I think json is not necessarily the good format when request size matter (I like protobuf but I don’t know if a patch mechanism exist for it).

And in Ben Foster’s blog entry, I also discovers that .Net core already have an aspnet/JsonPatch (available for .Net 4.5.1). It’s easy to use in http server or outside. You creates a JsonPatchDocument with a list of operation, you can add yours then you apply them with a ApplyTo. Json.Net is used internally and we can add a custom IContractResolver.

Source: How to perform partial resource updates with JSON Patch and ASP.NET Core – Ben Foster

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s