diff --git a/src/RestSharp/Serializers/Json/JsonSerializer.cs b/src/RestSharp/Serializers/Json/JsonSerializer.cs index 258756df6..72792f74a 100644 --- a/src/RestSharp/Serializers/Json/JsonSerializer.cs +++ b/src/RestSharp/Serializers/Json/JsonSerializer.cs @@ -120,7 +120,7 @@ object Map(object target, IDictionary data) if (!data.TryGetValue(name, out var value)) { var parts = name.Split('.'); - var currentData = data; + IDictionary currentData = new Dictionary(data, StringComparer.Create(Culture, true)); for (var i = 0; i < parts.Length; ++i) { diff --git a/test/RestSharp.Tests/JsonTests.cs b/test/RestSharp.Tests/JsonTests.cs index 98b28cd10..c320ba01a 100644 --- a/test/RestSharp.Tests/JsonTests.cs +++ b/test/RestSharp.Tests/JsonTests.cs @@ -436,6 +436,17 @@ public void Can_Deserialize_Lists_of_Simple_Types() Assert.IsNotEmpty(output.Numbers); } + [Test] + public void Can_Deserialize_Names_With_Double_Uppercase() + { + var doc = JsonData.CreateJsonWithDoubleUppercase(); + var serializer = new JsonSerializer(); + var response = new RestResponse { Content = doc }; + var p = serializer.Deserialize(response); + + Assert.AreEqual(435, p.PersonId); + } + [Test] public void Can_Deserialize_Names_With_Dashes_With_Default_Root() { diff --git a/test/RestSharp.Tests/SampleClasses/misc.cs b/test/RestSharp.Tests/SampleClasses/misc.cs index 112d1afa1..d101f9b06 100644 --- a/test/RestSharp.Tests/SampleClasses/misc.cs +++ b/test/RestSharp.Tests/SampleClasses/misc.cs @@ -127,6 +127,8 @@ public class PersonForJson public Order Order { get; set; } public Disposition Disposition { get; set; } + + public int PersonId { get; set; } } public enum Order { First, Second, Third } diff --git a/test/RestSharp.Tests/TestData/JsonData.cs b/test/RestSharp.Tests/TestData/JsonData.cs index 32b1a98ad..c72d15f13 100644 --- a/test/RestSharp.Tests/TestData/JsonData.cs +++ b/test/RestSharp.Tests/TestData/JsonData.cs @@ -126,6 +126,15 @@ public static string CreateJsonWithDashes() return doc.ToString(); } + public static string CreateJsonWithDoubleUppercase() + { + var doc = new JsonObject + { + ["personID"] = 435, + }; + return doc.ToString(); + } + public static string CreateJson() { var doc = new JsonObject