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

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

將Json字符串轉(zhuǎn)換為C#對象列表

將Json字符串轉(zhuǎn)換為C#對象列表

我想將json字符串轉(zhuǎn)換為對象列表。請幫我。如果由來完成,那會更有幫助NewtonJson。我試過了,但是沒有用。我不想要該json的所有值。MatrixModel中提到的這是一個對象public class MatrixModel{     public string S1 { get; set; }     public string S2 { get; set; }     public string S3 { get; set; }     public string S4 { get; set; }     public string S5 { get; set; }     public string S6 { get; set; }     public string S7 { get; set; }     public string S8 { get; set; }     public string S9 { get; set; }     public string S10 { get; set; }     public int ScoreIfNoMatch { get; set; }}這是Json String    "[       {         "Question": {           "QuestionId": 49,           "QuestionText": "Whats your name?",           "TypeId": 1,           "TypeName": "MCQ",           "Model": {             "options": [               {                 "text": "Rahul",                 "selectedMarks": "0"               },               {                 "text": "Pratik",                 "selectedMarks": "9"               },               {                 "text": "Rohit",                 "selectedMarks": "0"               }             ],             "maxOptions": 10,             "minOptions": 0,             "isAnswerRequired": true,             "selectedOption": "1",             "answerText": "",             "isRangeType": false,             "from": "",             "to": "",             "mins": "02",             "secs": "04"           }         },         "CheckType": "",         "S1": "",         "S2": "",         "S3": "",         "S4": "",         "S5": "",         "S6": "",         "S7": "",         "S8": "",         "S9": "Pratik",         "S10": "",         "ScoreIfNoMatch": "2"       },
查看完整描述

3 回答

?
白衣染霜花

TA貢獻(xiàn)1796條經(jīng)驗 獲得超10個贊

public static class Helper{
    public static string AsJsonList<T>(List<T> tt)
    {
        return new JavaScriptSerializer().Serialize(tt);
    }
    public static string AsJson<T>(T t)
    {
        return new JavaScriptSerializer().Serialize(t);
    }
    public static List<T> AsObjectList<T>(string tt)
    {
        return new JavaScriptSerializer().Deserialize<List<T>>(tt);
    }
    public static T AsObject<T>(string t)
    {
        return new JavaScriptSerializer().Deserialize<T>(t);
    }}


查看完整回答
反對 回復(fù) 2019-09-26
  • 3 回答
  • 0 關(guān)注
  • 753 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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