How to deserialize Json String dynamically

前端 未结 2 1525
醉话见心
醉话见心 2021-01-26 04:44

I have consume Survey data via SSE Stream that gives me each persons answers line by line with this format for Survey X:

{\"data\":[\"4         


        
2条回答
  •  野的像风
    2021-01-26 05:14

    why are you using StreamReader for reading JSON data?

    you can use JObject to parse your json and get data out of it.

    var json = @"{""data"":[""4482359"",""12526"",""5"",""5"","""",""Yes, that is right"",""1""]}";
    var obj = JObject.Parse(json);
    
    List lst = (obj["data"]).ToObject>();
    
    var result = JsonConvert.SerializeObject(lst);
    

提交回复
热议问题