Home/JSON → C# Class
JSON · C#

JSON → C# Class

Generate C# entity classes from JSON · Newtonsoft.Json annotations supported

Indent
Generation Options
Input JSONJSON
Generated resultC#

Overview: The JSON → C# Class generator turns sample JSON into C# entity classes, supporting auto-property syntax and optional [JsonProperty] annotations (Newtonsoft.Json). It suits a wide range of C# environments including .NET Core, ASP.NET, WPF and Unity, and is an efficient helper when integrating with REST APIs or message queues.

How to use: Step 1 — enter sample JSON on the left or click "Sample" to load a preset payload. Step 2 — fill in the namespace (for example MyApp.Models) and the root class name (default RootObject). Step 3 — choose whether to use auto-property syntax (recommended) and whether to add [JsonProperty] for precise control over serialized names. Step 4 — the right editor updates the C# code in real time; copy it or download as a .cs file. Nested JSON objects are split into multiple classes automatically and array elements are merged.

Typical scenarios: ASP.NET Core Web API developers create request / response models from agreed contracts; Unity game projects quickly generate config or protocol classes when talking to a back-end; desktop clients (WPF / WinForms) need strongly-typed models after fetching REST data; grabbing samples from Swagger / OpenAPI docs for batch import; converting configuration JSON shapes into Options classes to work with the IOptions<T> pattern.

Technical notes: Strings map to string, integers to int, floats to double, booleans to bool, arrays to List<T>, and mixed-type or null values become object. Class names are PascalCased and property names follow C# conventions. To use [JsonProperty], import using Newtonsoft.Json; or the equivalent System.Text.Json annotation [JsonPropertyName]. Generated code defaults to 4-space indentation and can be switched to 2.

Privacy: The whole class-generation process happens locally in your browser. The JSON you enter is never uploaded, so you can use it safely for entity modelling of internal business APIs.

Frequently Asked Questions

How do I use JSON → C# Class?
Step 2 — fill in the namespace (for example MyApp.Models ) and the root class name (default RootObject ). Step 3 — choose whether to use auto-property syntax (recommended) and whether to add [JsonProperty] for precise control over serialized names.
What can JSON → C# Class do?
Typical scenarios: ASP.NET Core Web API developers create request / response models from agreed contracts; Unity game projects quickly generate config or protocol classes when talking to a back-end; desktop clients (WPF / WinForms) need…
Is my data private when I use JSON → C# Class?
The JSON you enter is never uploaded, so you can use it safely for entity modelling of internal business APIs. The JSON you enter is never uploaded, so you can use it safely for entity modelling of internal business APIs.
What technical details should I know about JSON → C# Class?
Class names are PascalCased and property names follow C# conventions. To use [JsonProperty] , import using Newtonsoft.Json; or the equivalent System.Text.Json annotation [JsonPropertyName] .