How to deserialize a JSON array into an object using Json.Net?

前端 未结 2 481
一生所求
一生所求 2020-12-02 01:22

I\'ve a valid JSON object that has a JSON array in it. The JSON array doesn\'t have curly braces and contains a comma separated list of mixed type in it. It looks like this:

2条回答
  •  死守一世寂寞
    2020-12-02 01:50

    Use this to deserialize your data into a json object...

    public class Rootobject
    {
        public int ID { get; set; }
        public int Days { get; set; }
        public string Start_Date { get; set; }
        public string End_Date { get; set; }
        public string State { get; set; }
        public int Page { get; set; }
        public string Test { get; set; }
        public object[][] ROWS { get; set; }
    }
    

    ...and then create a utility function that converts the object[][] to your desired target object...

    (created with visual studio: Edit -> Paste Special -> JSON classes)

提交回复
热议问题