「VB.net」オブジェクトをJSONにするサンプル
書式
JsonConvert.SerializeObject(変数名)
サンプルコード
Imports Newtonsoft.Json
Module ModuleTest
Public Class User
Public Property uid As Integer
Public Property name As String
'配列
Public Property info As String()
End Class
Sub Main()
Dim tt As User = New User()
tt.uid = 322
tt.name = "user001"
tt.info = {"AA01", "BB02","CC03"}
'オブジェクトをJSON
Dim resJson As String = JsonConvert.SerializeObject(tt)
Console.WriteLine(resJson)
End Sub
End Module