试图从我的数组中获取数据Jobject
public PostModel GetOnePost(PostModel postmodel, string token)
{
JObject response = context.GetOnePost(postmodel, token);
PostModel post = new PostModel();
post.Title = response.SelectToken("title").Value<string>();
post.Content = response.SelectToken("content").Value<string>();
post.Urgency = response.SelectToken("urgency").Value<string>();
post.Slug = response.SelectToken("slug").Value<string>();
post.Completed = response.SelectToken("completed").Value<bool>();
return post;
}
我想从数据数组中获取标题...我该怎么做?这也不起作用 response.SelectToken("data.title")
{{
"success": true,
"msg": "Post received",
"data": {
"postId": "91207a39-6faa-4372-86dc-c5aa6e9f720c",
"title": "End me",
"content": "please",
"slug": "end-me",
"urgency": "low",
"completed": false,
"createdAt": "2019-04-23T08:26:18.988Z",
"updatedAt": "2019-04-23T08:26:18.988Z",
"clientClientId": "f379f920-a6f9-45b0-95c8-5f91138fb7a5",
"tags": []
}
}} Newtonsoft.Json.Linq.JToken {Newtonsoft.Json.Linq.JObject}
侃侃尔雅
相关分类