Skip to content

Instantly share code, notes, and snippets.

View MJSanfelippo's full-sized avatar

Michael Sanfelippo MJSanfelippo

View GitHub Profile
@MJSanfelippo
MJSanfelippo / JsonDiffPatch.cs
Last active January 1, 2024 21:58
Original credit for this goes to the user bymyslf. I have edited it to work correctly in some array edge cases. Creates a JsonPatchDocument from a left and right JToken. I did not include the tests for this, but this code has been running in production with no issues for all of our different use cases.
namespace JsonDiffPatch
{
using Microsoft.AspNetCore.JsonPatch;
using Microsoft.AspNetCore.JsonPatch.Operations;
using Newtonsoft.Json.Linq;
using System.Collections.Generic;
using System.Linq;
public static class JsonDiffPatch
{