0

I have an issue that is driving me nuts. I have a project to deserialize and process a json response:

 [{"summary":[{"cardDate":"2013-08-06","cardId":46121,"contenderList":[1,2,3,4,5,7,8,10],"dateTime":"2013-08-06 10:36","marketList":["TOTE_WIN_PLACE","FORECAST","FORECAST_PLACE"],"raceId":465453,"raceNumber":2,"tote":"Australia","venue":"AU - Dog, Bendigo"}]

I have built classes to handle the response:

Public Class clsAXMeetList
    Public Property summary() As clsAXRaceList()
End Class
Public Class clsAXRaceList
    Public Property cardDate As String
    Public Property cardID As Integer
    Public Property [contenderList]() As clsAXContenderList()
    Public Property dateTime As String
    Public Property [marketList]() As clsAXMarketList()
    Public Property raceID As String
    Public Property raceNumber As Integer
    Public Property tote As String
    Public Property venue As String
End Class

Public Class clsAXContenderList
    Public Property runners() As Integer
End Class
Public Class clsAXMarketList
    Public Property [a] As String
    Public Property [b] As String
    Public Property [c] As String
End Class

but when the deserializer hits the first value in the contender list (1) it throws this error:

Error converting value 1 to type 'AsiaExchange.clsAXContenderList'. Path '[0].summary[0].contenderList[0]', line 1, position 71.

I have looked around and I cant find much help

4

1 回答 1

0

contenderList是一个数字数组,而不是对象。没有从数字到任意对象的转换。您需要将contenderList属性更改为整数数组 ( Integer()) 或为您的对象提供转换器。您也必须这样做marketList

于 2013-08-08T05:28:47.357 回答