Google Maps API와 비슷한 방향 API에서 반환 된 json을 비 직렬화하려고합니다.Complex JSON (VB.NET) 역 직렬화
jsontext = { "버전": 0.3, "상태": 0, "route_summary" { "total_distance을"(I 2008 VB.NET을 사용하고 있습니다) 다음과 같이 내 JSON은 다음과 같습니다 300 "TOTAL_TIME"14 "start_point": "43", "end_point": "42" } "route_geometry"[51.025421,18.647631], [51.026131,18.6471] [51.027802, [42 "에서 계속, 212,1,10,"18.645639]], "route_instructions": [[ "43 북북서, 88,0,4,"88m ","NW ", 334.8] 0.2km ","NW ", 331.1,"C ", 356.3]] }
지금까지 나는 다음과 같은 코드를 내놓았다 :
Dim js As New System.Web.Script.Serialization.JavaScriptSerializer
Dim lstTextAreas As Output_CloudMade() = js.Deserialize(Of Output_CloudMade())(jsontext)
I, 즉 Output_CloudMade 복잡한 클래스를 정의하는 방법을 모르겠어요.
내가 좋아하는 뭔가를 시도하고있다 :
Public Class RouteSummary
Private mTotalDist As Long
Private mTotalTime As Long
Private mStartPoint As String
Private mEndPoint As String
Public Property TotalDist() As Long
Get
Return mTotalDist
End Get
Set(ByVal value As Long)
mTotalDist = value
End Set
End Property
Public Property TotalTime() As Long
Get
Return mTotalTime
End Get
Set(ByVal value As Long)
mTotalTime = value
End Set
End Property
Public Property StartPoint() As String
Get
Return mStartPoint
End Get
Set(ByVal value As String)
mStartPoint = value
End Set
End Property
Public Property EndPoint() As String
Get
Return mEndPoint
End Get
Set(ByVal value As String)
mEndPoint = value
End Set
End Property
End Class
Public Class Output_CloudMade
Private mVersion As Double
Private mStatus As Long
Private mRSummary As RouteSummary
'Private mRGeometry As RouteGeometry
'Private mRInstructions As RouteInstructions
Public Property Version() As Double
Get
Return mVersion
End Get
Set(ByVal value As Double)
mVersion = value
End Set
End Property
Public Property Status() As Long
Get
Return mStatus
End Get
Set(ByVal value As Long)
mStatus = value
End Set
End Property
Public Property Summary() As RouteSummary
Get
Return mRSummary
End Get
Set(ByVal value As RouteSummary)
mRSummary = value
End Set
End Property
'Public Property Geometry() As String
' Get
' End Get
' Set(ByVal value As String)
' End Set
'End Property
'Public Property Instructions() As String
' Get
' End Get
' Set(ByVal value As String)
' End Set
'End Property
End Class
을했지만 작동하지 않습니다. 문제는 route_summary와 같은 복잡한 속성 때문입니다. 그것은 "아무것도"로 가득 차 있습니다. "상태"또는 "버전"과 같은 다른 속성은 올바르게 채워집니다.
모든 아이디어, 위의 JSON에 대한 클래스를 정의하는 방법?
VB.NET에서 JSON을 비 직렬화하는 작업 코드를 공유 할 수 있습니까?
감사합니다,