I am trying to get the values of this object, this object was a dynamic property in a parsed json object. When I try getting the information i keep getting returned 12 properties. One is JToken.First, JToken.Last. These give the information in the right way, but they do not give all of the information, the goal is to get all of the information stored in the dynamic object.
public class JsonWrapper
{
public static dynamic UnWrapDynamic(dynamic obj)
{
PropertyInfo[] objectInfo = obj.GetType().GetProperties();
foreach (PropertyInfo propertyInfo in objectInfo)
{
if (propertyInfo.PropertyType.Name == nameof(JToken) && propertyInfo.Name == nameof(JToken.First))
{
return (JToken)propertyInfo.GetValue(obj).Values;
}
}
return null;
}
}
- List item