'Arbitrary Value JsonDiffPatch.net diff function output
I am trying to find the changed values on website. For that I have written a iterator which will hit the website and get the html output. I have saved that html output in a json array against country name.
Next time it checks new json value with old json using JsonDiffPatch. But diff method returns some arbitary value in result.
Output:
{{
"vaccineInfo": [
"@@ -245,20 +245,8 @@\n ines\n- HELLO World\n %3c/h3\n",
0,
2
]
}}
My C# Code block:
var diffObj = new JsonDiffPatch();
var resultJsonDiff = diffObj.Diff(expected, actual);
List<string> uniqueIndexKeysActual = new List<string>();
foreach (var tempToken in resultJsonDiff)
{
JObject obj = JObject.Parse("{" + tempToken.ToString() + "}");
foreach (var pair in obj)
{
int outResult = 0;
if (!uniqueIndexKeysActual.Contains(pair.Key) && int.TryParse(pair.Key, out outResult))
{
uniqueIndexKeysActual.Add(pair.Key);
}
Console.WriteLine(pair.Key + "," + pair.Value);
}
}
So in pair.value
I get above output result.
Could anyone help with the same. Thanks.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|