public JsonDiffPatch(Options options) { if (options == null) throw new ArgumentNullException(nameof(options)); _options = options; }
private static string CompareJson(JToken json1, JToken json2) { if (json1 == null) { throw new ArgumentException("Must not be null", nameof(json1)); } if (json2 == null) { throw new ArgumentException("Must not be null", nameof(json2)); } // This doesn't work because it doesn't support dynamic objects. /* * var config = new ComparisonConfig * { * MaxStructDepth = 5, * MaxDifferences = 100 * }; * * var compareLogic = new CompareLogic(config); * var if (JToken.DeepEquals(json1, json2)) * { * return null; * } * elseresult = compareLogic.Compare(json1, json2); */ // This just compares but doesn't show differences. // var result1 = json1.IsDeepEqual(json2); var x = new JsonDiffPatchDotNet.Options() { TextDiff = TextDiffMode.Simple, ArrayDiff = ArrayDiffMode.Simple, MinEfficientTextDiffLength = long.MaxValue }; var jdp = new JsonDiffPatch(x); var jsonResult = jdp.Diff(json1, json2); var result = JsonConvert.SerializeObject(jsonResult, Formatting.Indented); return(result); }