私はjsonを逆シリアル化する次の関数を持っています:
Public Sub getDataTable(ByVal json As String)
json = <json>{"TYPE_OF_HANDSET": "4","SMS": [{"DATE": "19.10.2013 13:20","FROM": "SAWA Promo","MESSAGE": "Special offer only for you! Get 300 MB internet + 200 SR Extra Bonus valid for 7 days for only 20 SR. Send 1 to 804097 via SMS. Extra bonus can be used to call and SMS all STC numbers. Happy browsing with SAWA!"},{"DATE": "19.10.2013 13:20","FROM": "SAWA Promo","MESSAGE": "Special offer only for you! Get 300 MB internet + 200 SR Extra Bonus valid for 7 days for only 20 SR. Send 1 to 804097 via SMS. Extra bonus can be used to call and SMS all STC numbers. Happy browsing with SAWA!"}],"DESC": "Samsung GT-I9100","ID_USER": "261"}</json>.Value
Dim data As New DataBck
data = JsonConvert.DeserializeObject(Of DataBck)(json)
handsetType = data.handset
DESC = data.DESC
ID_USER = data.ID_USER
smsDT = data.sms
End Sub
および次のクラス:
Public Class DataBck
<System.Runtime.Serialization.DataMember(Name:="TYPE_OF_HANDSET")>
Public handset As Integer
<System.Runtime.Serialization.DataMember(Name:="DESC")>
Public DESC As String
<System.Runtime.Serialization.DataMember(Name:="ID_USER")>
Public ID_USER As Integer
Public sms As DataTable
End Class
jsonを逆シリアル化すると、フィールド名TYPE_OF_HANDSETのみが空で埋められ、すべてのフィールド名が正しく埋められます。HANDSETに置き換えると、アンダースコアを削除せずにID_USERが正しく埋められますが、正しく埋められます...
助言がありますか?