//這是一個json字符串
string str="{\"id\":1,\"name\":\"張三\",\"time\":\"2018-05-02T09:02:32.1869172+08:00\",\"money\":23.4,\"str\":[\"a\",\"b\",\"c\"]}";
//轉化為對象
User user =(User) Jayrock.Json.Conversion.JsonConvert.Import(typeof(User),str);
//獲得對象myClass的所有屬性組成的集合 propertys 需要引用using System.Reflection;
PropertyInfo[] p = user.GetType().GetProperties();
foreach (PropertyInfo pinfo in p)
{
Response.Write("<br>"+pinfo.Name+","+pinfo.GetValue(user,null));
}
輸出結果
不知道為什么數組不行