Deserializing JSON array into strongly typed .NET object

前端 未结 8 745
一个人的身影
一个人的身影 2020-11-30 07:35

When I can call the 3rd party api and get back a single class worth of data everything deserialises fine using this code

TheUser me = jsonSerializer.Deseria         


        
8条回答
  •  眼角桃花
    2020-11-30 07:40

    I suspect the problem is because the json represents an object with the list of users as a property. Try deserializing to something like:

    public class UsersResponse
    {
        public List Data { get; set; }
    }
    

提交回复
热议问题