diff --git a/CryptoExchange.Net/Testing/Comparers/JsonNetComparer.cs b/CryptoExchange.Net/Testing/Comparers/JsonNetComparer.cs index 3a4957a..2c7943b 100644 --- a/CryptoExchange.Net/Testing/Comparers/JsonNetComparer.cs +++ b/CryptoExchange.Net/Testing/Comparers/JsonNetComparer.cs @@ -25,7 +25,11 @@ namespace CryptoExchange.Net.Testing.Comparers var resultProperties = resultData.GetType().GetProperties().Select(p => (p, (JsonPropertyAttribute?)p.GetCustomAttributes(typeof(JsonPropertyAttribute), true).SingleOrDefault())); var jsonObject = JToken.Parse(json); if (nestedJsonProperty != null) - jsonObject = jsonObject[nestedJsonProperty]; + { + var nested = nestedJsonProperty.Split('.'); + foreach (var nest in nested) + jsonObject = jsonObject![nest]; + } if (userSingleArrayItem) jsonObject = ((JArray)jsonObject!)[0]; diff --git a/CryptoExchange.Net/Testing/Comparers/SystemTextJsonComparer.cs b/CryptoExchange.Net/Testing/Comparers/SystemTextJsonComparer.cs index a15f6e6..af39185 100644 --- a/CryptoExchange.Net/Testing/Comparers/SystemTextJsonComparer.cs +++ b/CryptoExchange.Net/Testing/Comparers/SystemTextJsonComparer.cs @@ -24,7 +24,11 @@ namespace CryptoExchange.Net.Testing.Comparers var resultProperties = resultData.GetType().GetProperties().Select(p => (p, (JsonPropertyNameAttribute?)p.GetCustomAttributes(typeof(JsonPropertyNameAttribute), true).SingleOrDefault())); var jsonObject = JToken.Parse(json); if (nestedJsonProperty != null) - jsonObject = jsonObject[nestedJsonProperty]; + { + var nested = nestedJsonProperty.Split('.'); + foreach(var nest in nested) + jsonObject = jsonObject![nest]; + } if (userSingleArrayItem) jsonObject = ((JArray)jsonObject!)[0];