JSON to VB.NET Class

Convert JSON to Visual Basic .NET classes with JSON attributes

A free JSON to VB.NET converter: paste JSON and get Visual Basic .NET classes back instantly. Each class has auto-implemented properties with types inferred from the data, nested objects become their own classes, and <JsonPropertyName> (System.Text.Json) or <JsonProperty> (Newtonsoft.Json) attributes preserve the original JSON key names. Reserved words such as Class or Error are escaped with [brackets]. Conversion runs entirely in your browser, so your JSON is never uploaded to a server.

Options on this page

Output format: Class — Public Class with auto-implemented properties.

OptionWhat it does
Root Class NameNames the top-level Class.
Namespace (optional)Wraps the classes of each file in a Namespace ... End Namespace block.
Field Naming ConventionOne of PascalCase, camelCase, Preserve Original. Defaults to PascalCase.
Type for null valuesEither Object or String, used when a key is null in every sample.
Non-nullable value typesEmit Integer / Long / Double / Boolean instead of Integer? / Long? / Double? / Boolean? for fields present in every sample.
Separate ClassesWrite each class to its own .vb file. Off (the default) puts every class in one file, so Copy All pastes into a single file that compiles.
Add JSON attributesAnnotate properties with the original JSON key — <JsonPropertyName> or <JsonProperty>, depending on the library. Without them a property only binds to a key spelled exactly like it (System.Text.Json is case-sensitive), so snake_case or camelCase keys are silently ignored.
JSON libraryOne of System.Text.Json or Newtonsoft.Json; picks which JSON library the generated code is written for.

How JSON values map to VB.NET types

JSON valueVB.NET type
stringString
integerInteger (Integer?)
integer beyond 32 bitsLong (Long?)
decimalDouble (Double?)
true / falseBoolean (Boolean?)
ISO-8601 timestampDate (Date?)
arrayList(Of T)
objectnested class
nullObject (configurable)

Example

Input JSON

{
  "id": 12345,
  "product_name": "Wireless Mouse",
  "price": 24.99,
  "in_stock": true,
  "tags": ["electronics", "accessories"],
  "manufacturer": {
    "name": "Acme Corp",
    "country": "US"
  }
}

Generated VB.NET

Public Class Product
    <JsonPropertyName("id")>
    Public Property Id As Integer?

    <JsonPropertyName("product_name")>
    Public Property ProductName As String

    <JsonPropertyName("price")>
    Public Property Price As Double?

    <JsonPropertyName("in_stock")>
    Public Property InStock As Boolean?

    <JsonPropertyName("tags")>
    Public Property Tags As List(Of String)

    <JsonPropertyName("manufacturer")>
    Public Property Manufacturer As Manufacturer
End Class

Frequently asked questions

How do I convert JSON to a VB.NET class?

Paste your JSON into the input pane and the Visual Basic classes appear beside it immediately. Set the root class name and an optional namespace, choose System.Text.Json or Newtonsoft.Json, then copy the code or download it. Nested JSON objects become their own classes and arrays become List(Of T).

Why is there no record option for VB.NET?

Visual Basic has no record type, so the converter produces ordinary classes with auto-implemented properties. If you need an immutable positional record, use the C# page instead; the two languages share the same JSON libraries.

Why are the value types Integer? and Double? by default?

A JSON value can be null or missing, and a plain Integer would silently turn that into 0. The default keeps the nullable form so nothing is lost; turn on Non-nullable value types to get plain Integer, Long, Double, and Boolean for fields that are present in every sample.

What happens to JSON keys that are VB.NET reserved words?

A property named after a reserved word, such as Class, Error, or Next, is written in square brackets ([Class]) so it compiles, and the JSON attribute keeps the original key. Class names that would collide with a keyword or with List or Date get a longer, disambiguated name.

Is my JSON uploaded anywhere?

No. Parsing, type inference, and code generation all run in your browser using JavaScript. Your JSON is never sent to a remote server, and there is no account to create. The page keeps your last input and settings in your own browser (localStorage) so they survive a reload; nothing is stored anywhere else.

Is it safe to paste confidential JSON, such as API responses or customer data?

The conversion itself never transmits your JSON, so a confidential payload does not leave your machine. You can verify this: open your browser DevTools, switch to the Network tab, and convert something — no request carries your data. Two things to know: your last input is saved in your browser's localStorage (clear site data to remove it), and the Copy Link button embeds your JSON in the link, so anyone who opens that link, and the server that receives the request, can see it. Only share such links where you are comfortable with that.

Does it cost anything?

No. The generator is free to use with no sign-up and no usage limits.

How are nested objects handled?

Each nested JSON object becomes its own named type, derived from the key it appeared under. Arrays of objects are widened across every element, so a field that is a whole number in one element and a fraction in another gets a type that holds both.

Other languages

More JSON tools