vb.net json.net反序列化问题



我遇到了一个让我抓狂的问题。我有一个反序列化和处理json响应的项目:

 [{"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"}]

我已经建立了处理响应的类:

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

但是当反序列化程序命中竞争者列表(1)中的第一个值时,它会抛出以下错误:

将值1转换为类型"AsiaExchange.clsACXContenderList"时出错。路径"[0].summary[0].simpleteList[0]",第1行,位置71。

我环顾四周,找不到太多帮助

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

相关内容

  • 没有找到相关文章

最新更新