vb.netでjsonのシリアライズ
Public Function Deserialize(Of T)(json As String) As T
Dim result As T
Dim serializer As New DataContractJsonSerializer(GetType(T))
Using stream As New IO.MemoryStream(System.Text.Encoding.UTF8.GetBytes(json))
result = DirectCast(serializer.ReadObject(stream), T)
End Using
Return result
End Function
Dim result As T
Dim serializer As New DataContractJsonSerializer(GetType(T))
Using stream As New IO.MemoryStream(System.Text.Encoding.UTF8.GetBytes(json))
result = DirectCast(serializer.ReadObject(stream), T)
End Using
Return result
End Function
関連 2017-08-15 13:20:42