I am having trouble in converting some string to JSON.
I use C# WebAPI to Deserialize string
First:
List<GetBookInfoModel> list = JsonConvert.DeserializeObject<List<GetBookInfoModel>>(strOutput01);Second:
List <GetBookDetInfoModel> list = JsonConvert.DeserializeObject<List<GetBookDetInfoModel>>(strOutput01);
And my Json String is like:
First:
[{"allbook ":{ " count01 " :3}, " late ":{ " count02 ":0}}]Second:
[{"num ":1, " bookname ":"AAAAA","FinTime ":"2017"},{"num ":2, " bookname ":"iOS","FinTime ":"2017"},{"num ":3, " bookname ":"Visual","FinTime ":"2017"}]
And my Model class is like..
public class GetBookInfoModel
{
List<GetBookSecondInfoModel> allbook { get; set; }
List<GetBookSecondInfoModel> late { get; set; }
}
public class GetBookSecondInfoModel
{
public string count01 { get; set; }
public string count02 { get; set; }
}
public class GetBookDetInfoModel
{
public string num { get; set; }
public string bookname { get; set; }
public string FinTime { get; set; }
}
But now it returns null.
How can I resolve this problem?Thanks.