我有一个类似的JSON数组
model.Users = ["Joe","Barny","Power","Tester"]
型号为dynamic
我想将model.Users
转换为string[] Users
string[] Users = model.Users
我该怎么做?
如果model.Users
属于Newtonsoft.Json.Linq.JArray
类型,请尝试调用:
string[] Users = model.Users.ToObject<string[]>()
string[] Users = new string[20];
int i = 0;
foreach ( string item in model.Users )
{
Users[i] = item;
i++;
}