Merge branch 'main' into cmd
This commit is contained in:
@@ -146,13 +146,26 @@ namespace Newtonsoft.Json
|
||||
if (lvlObj == null)
|
||||
return defaultValue;
|
||||
|
||||
lvlObj = lvlObj[level];
|
||||
string lvl = level;
|
||||
if (lvlObj.Type == JTokenType.Object)
|
||||
{
|
||||
foreach (var prop in ((JObject)lvlObj).Properties())
|
||||
{
|
||||
if (prop.Name.Equals(lvl, System.StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
lvl = prop.Name;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lvlObj = lvlObj[lvl];
|
||||
}
|
||||
|
||||
if (lvlObj == null)
|
||||
return defaultValue;
|
||||
|
||||
return DeepConvert.ChangeType<T>(lvlObj is JValue ? ((JValue)lvlObj).Value : lvlObj.Value<object>());
|
||||
return DeepConvert.ChangeType<T>(lvlObj is JValue lvlValue ? lvlValue.Value : lvlObj.Value<object>());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user