JSON to C# Class
Paste JSON, get C# classes with PascalCase properties and the right serializer attribute on every key that would otherwise deserialize to null.
C# does not care about declaration order, so classes are emitted parent first. null becomes object and an empty array List<object> — the tool cannot know what they were meant to be. Tick nullable reference types if your project has <Nullable>enable</Nullable>, otherwise string properties will warn.
About JSON to C# Class
Paste JSON and get C# classes: PascalCase properties, with the right serializer attribute on every key that had to be renamed.
C# is a little easier than Java, but the attribute is not optional. Once class becomes Class it is no longer a keyword (C# keywords are all lowercase), so there is no need for the class_ trick Java requires. But user_name becomes UserName, and the serializer only knows UserName — without the attribute it silently deserialises to null. That is the most common way this kind of tool produces broken code.
The two serializers are not interchangeable, and picking wrong compiles fine but yields empty objects. System.Text.Json (the default since .NET Core 3.0) uses [JsonPropertyName]; older projects use Newtonsoft's [JsonProperty]. Neither recognises the other's attribute, so this is a dropdown rather than a guess.
Nullable reference types depend on your project. With <Nullable>enable</Nullable>, uninitialised properties produce CS8618 warnings — tick the box and reference types get a ?. Older projects without the feature should leave it off, or string? will not compile.
Three things it cannot infer: null becomes object, an empty array List<object>, and a field only some records carry is still generated (null at runtime for the rest).
Frequently asked questions
Will the output compile?
Yes. System.Text.Json ships with .NET Core 3.0 and later, so no extra package. The Newtonsoft mode needs the Newtonsoft.Json package.
Why is JsonPropertyName needed?
Whenever the property name differs from the JSON key. C# properties are PascalCase while JSON usually uses snake_case; without the attribute you silently get null.
System.Text.Json or Newtonsoft?
New projects: System.Text.Json (built in, faster). Projects on .NET Framework or already using Newtonsoft: pick Newtonsoft.
Why the CS8618 warnings?
Nullable reference types are enabled but the properties are not initialised. Tick the nullable box so reference types become string?, or give the properties a default.
Why does null become object?
There is no way to infer what type it should have been. Change it by hand once you know your data.
Is my JSON uploaded?
No. Everything runs in your browser.