VisualBasic Integration

The VisualBasic TypeSchema integration uses the native System.Text.Json implementation, this means you don`t need to install any additional package to use the generated DTOs.

DTO

Imports System.Text.Json.Serialization

' A simple student struct
Public Class Student
    <JsonPropertyName("firstName")>
    Public Property FirstName As String

    <JsonPropertyName("lastName")>
    Public Property LastName As String

    <JsonPropertyName("age")>
    Public Property Age As Integer

End Class

Integration

Imports System.Text.Json
Imports Generator.Generator
Imports Microsoft.VisualBasic.FileIO

Module Program
    Sub Main(args as String())
        Dim input As String
        Dim output As String
        Dim student As Student

        input = FileSystem.ReadAllText("input.json")

        student = JsonSerializer.Deserialize(Of Student)(input)

        output = JsonSerializer.Serialize(student)

        FileSystem.WriteAllText("output.json", output, True)
    End Sub
End Module