Output will appear here
Output will appear here
Generate C# classes from JSON with our free JSON to C# converter. The tool creates properly typed classes with JsonPropertyName attributes, nullable reference type support, and separate definitions for nested objects. Perfect for .NET developers working with REST APIs, ASP.NET controllers, or any System.Text.Json serialization workflow.
Try Convert All - paste JSON once, see TypeScript, Go, YAML, and 15 more formats instantly.
Enter a JSON object or array in the editor. Complex structures with nested objects, arrays, and mixed types are all supported.
The output shows C# classes with auto-properties and JsonPropertyName attributes for System.Text.Json serialization.
Copy the classes or download a .cs file ready to add to your .NET project. Works with .NET 6+ and System.Text.Json out of the box.
The default output uses [JsonPropertyName] from System.Text.Json, the built-in serializer in .NET 6+. The generated classes also work with Newtonsoft.Json if you swap the attribute to [JsonProperty].
JSON fields with null values produce properties with the nullable suffix (e.g., string?). This is compatible with C# nullable reference types and ensures your code compiles cleanly with <Nullable>enable</Nullable>.
Yes. The generated classes are plain POCOs that ASP.NET model binding can deserialize directly from request bodies, query strings, or route values without extra configuration.
Nested objects generate separate class definitions named after their parent key in PascalCase. For example, a key "order_details" produces a class named OrderDetails, keeping naming consistent with .NET conventions.