background image

Free Developer Tool - runs 100% in your browser

JSON to C#

Scroll down to learn more about this tool

Convert JSON to C# classes online

This JSON to C# converter turns any JSON payload into ready-to-use C# POCO classes. It maps JSON types to idiomatic C# types (int, double, string,bool, List<T>), creates a separate class for every nested object, converts snake_case keys to PascalCase properties, and can add[JsonPropertyName] attributes for System.Text.Json so deserialization just works.

Deserializing JSON in .NET

Once you've pasted the generated classes into your project, deserializing an API response is one line:

var data = JsonSerializer.Deserialize<Root>(json);

The attributes keep the original JSON key names intact, so user_name in the payload still binds to the UserName property. If you prefer Newtonsoft.Json, replace the attribute with[JsonProperty("user_name")] - the class shapes are identical.

Type mapping rules

  • Whole numbers → int (or long when they exceed int range).
  • Decimals → double.
  • null → nullable object? so you can refine the type yourself.
  • Arrays → List<T> typed from the first element.
  • Nested objects → their own generated class.

Everything runs in your browser - no JSON is sent anywhere. Working on the frontend too? Generate matching types with the JSON to TypeScript converter.

More free developer tools