JSON to C# Class Converter

Paste a JSON sample and get C# classes with auto-properties, one class per nested object and List<T> for arrays, ready to deserialize with System.Text.Json or Newtonsoft.Json.

Input Code
Ready - Type or paste code in the left panel
Output Code
Ready - Type or paste code in the left panel

How to convert JSON to C#

  1. Paste your JSON into the left panel, or click Load Sample.
  2. C# is already selected as the output on the right.
  3. Click Convert, then Copy Output.

Example

This JSON:

{ "id": 101, "name": "Ada Lovelace", "email": "ada@example.com", "active": true, "balance": 250.75,
  "address": { "city": "London", "postcode": "N1 9GU" }, "tags": ["admin", "beta"] }

becomes:

using System.Collections.Generic;

public class Address
{
    public string City { get; set; }
    public string Postcode { get; set; }
}

public class RootObject
{
    public int Id { get; set; }
    public string Name { get; set; }
    public string Email { get; set; }
    public bool Active { get; set; }
    public double Balance { get; set; }
    public Address Address { get; set; }
    public List<string> Tags { get; set; }
}

How JSON types map to C#

JSON valueC# type
"text"string
101int
250.75double
truebool
{ … }a new class named after the key
["a", "b"]List<string>

Deserializing the JSON

var options = new JsonSerializerOptions { PropertyNameCaseInsensitive = true };
var root = JsonSerializer.Deserialize<RootObject>(json, options);

The properties are PascalCase, as C# style expects, while JSON keys are usually camelCase. ASP.NET Core handles that automatically; on your own, set PropertyNameCaseInsensitive as above or JsonNamingPolicy.CamelCase. With Newtonsoft.Json, JsonConvert.DeserializeObject<RootObject>(json) matches case-insensitively by default.

Things to check after generating

Is my JSON sent anywhere?

Your JSON is sent to our server, converted in memory and returned; it isn't stored. See the privacy policy.

Frequently asked questions

How do I convert JSON to a C# class?

Paste the JSON on the left, keep C# selected on the right and click Convert. Copy the classes into your project and deserialize with JsonSerializer.Deserialize.

Why are the property names PascalCase?

That is the C# convention. Use case-insensitive matching or a camelCase naming policy so they still map to camelCase JSON keys.

Does it work with Newtonsoft.Json?

Yes. The classes are plain properties, so both System.Text.Json and Newtonsoft.Json can read them.

Does it handle nested objects?

Yes. Each nested object becomes its own class and arrays become List properties.

Other languages: JSON to Java · JSON to TypeScript · JSON to Go · JSON to Python · JSON to Kotlin · all languages

Share Content

Choose what to share and generate an instant link

🔥 One-time link Content deleted from server after first view
✉️
Uploading to server…