code

JSON to C#

Convert JSON into C# classes decorated with System.Text.Json attributes. Integers map to int, decimals to double, booleans to bool, and arrays to List<T>. Runs entirely in your browser.

code

About JSON to C#

Generates C# classes with System.Text.Json attributes. Integers map to int, decimals to double, booleans to bool, and arrays to List<T>. Validate your JSON first using theJSON Formatter, or generate types for other languages withJSON to TypeScript andJSON to Go.

shield_lock

Secure & Private Client-Side

This tool runs entirely in your browser. No data is sent to any server, ensuring your information remains private and secure.

About JSON to C#

Convert JSON into C# classes decorated with System.Text.Json attributes. Integers map to int, decimals to double, booleans to bool, and arrays to List<T>. Runs entirely in your browser.

Frequently Asked Questions

Which JSON library is supported? expand_more

The generated classes use System.Text.Json with [JsonPropertyName] attributes, the default serializer in modern .NET.

Can I use these classes with Newtonsoft.Json? expand_more

Yes, but you will need to switch the attribute to [JsonProperty("name")] from the Newtonsoft.Json namespace, or use a property naming contract.

How are nullable values handled? expand_more

JSON null is mapped to object. For nullable value types, change int to int? or string to string? as needed.

Generate types for other languages? expand_more

Use [JSON to TypeScript](/tools/json-to-typescript/) or [JSON to Go](/tools/json-to-go/).

Is the conversion done locally? expand_more

Yes. No data is uploaded; the conversion runs entirely in your browser.

Common Use Cases

  • .NET APIs: Generate C# DTO classes for deserializing JSON responses.
  • Unity Games: Model save files or server payloads as strongly typed classes.
  • Azure Functions: Build request and response bindings from sample JSON.
  • Legacy Migration: Convert JSON-shaped data into C# classes when refactoring older code.