第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

從 IRestResponse 請(qǐng)求中讀取數(shù)組

從 IRestResponse 請(qǐng)求中讀取數(shù)組

C#
猛跑小豬 2022-12-24 14:58:48
試圖從我的數(shù)組中獲取數(shù)據(jù)Jobjectpublic 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;        }我想從數(shù)據(jù)數(shù)組中獲取標(biāo)題...我該怎么做?這也不起作用 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}
查看完整描述

1 回答

?
侃侃爾雅

TA貢獻(xiàn)1801條經(jīng)驗(yàn) 獲得超16個(gè)贊

如果你想獲取tagsas JSON 數(shù)組,你可以執(zhí)行以下操作


JObject response = context.GetOnePost(postmodel, token);

JArray array = JArray.Parse(response["data"]["tags"].ToString());

要獲取title和content作為字符串,您可以執(zhí)行以下操作


JObject response = context.GetOnePost(postmodel, token);

PostModel post = new PostModel();

post.Title = response["data"]["title"].ToString();

post.Content = response["data"]["content"].ToString();

.

.

.


查看完整回答
反對(duì) 回復(fù) 2022-12-24
  • 1 回答
  • 0 關(guān)注
  • 78 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)