Open dhu5432 opened 1 year ago
JSON -> Dictionary<string, string>
{"name":"Premium"} {"nam/e":"Premium"}
The JSON path of the first entry is "name". The JSON path of the second entry is "na/me"
The JSON path of the first entry is "name". The JSON path of the second entry is "['nam/e']"
string object1 = @"{""name"" : ""Premium""}"; var object1Deserialized = JsonConvert.DeserializeObject<Dictionary<string,string>>(object1); var object1JToken = JToken.FromObject(object1Deserialized); Assert.AreEqual("name", object1JToken.Children().First().Path); string object2 = @"{""nam/e"" : ""Premium""}"; var object2Deserialized = JsonConvert.DeserializeObject<Dictionary<string, string>>(object2); var object2JToken = JToken.FromObject(object2Deserialized); Assert.AreEqual("['nam/e']", object2JToken.Children().First().Path);
The code/test case above passes, even though I would expect object2's path to be na/me Using .NET 7.0 and Newtonsoft.Json 13.0.2
object2
na/me
Source/destination types
Source/destination JSON
Expected behavior
The JSON path of the first entry is "name". The JSON path of the second entry is "na/me"
Actual behavior
The JSON path of the first entry is "name". The JSON path of the second entry is "['nam/e']"
Steps to reproduce
The code/test case above passes, even though I would expect
object2
's path to bena/me
Using .NET 7.0 and Newtonsoft.Json 13.0.2