ToolHub
Open Tool

JSON to C# Class

Convert JSON to C# class definitions with auto type detection and attribute support

Format Converter

About This Tool

JSON to C# Class converts JSON data into C# class definitions with automatic type detection. It supports both System.Text.Json and Newtonsoft.Json attributes, handles nested classes and lists, and offers nullable reference type options. This tool helps .NET developers quickly create models for API integration and data serialization.

Key Features

Quick Preview

Use Cases

json csharp dotnet class

Frequently Asked Questions

What is JSON to C# Class?

JSON to C# Class is a browser-based tool that converts JSON data into C# class definitions with automatic type detection. It generates proper C# types, handles nested objects, and adds JSON serialization attributes.

Which JSON libraries are supported?

The tool supports both System.Text.Json (using JsonPropertyName attributes) and Newtonsoft.Json (using JsonProperty attributes). You can select your preferred library from the options.

Does it handle nested objects?

Yes, the tool automatically generates separate C# classes for nested JSON objects. Each nested class is properly defined with its own properties and JSON attributes.

What is the nullable reference types option?

When enabled, the tool adds nullable type annotations (e.g., string?) for JSON fields with null values. This helps maintain C# 8.0+ nullable reference type compatibility.

Is my JSON data sent to any server?

No. All conversion happens locally in your browser. Your JSON data is never uploaded or transmitted to any server, keeping it completely private and secure.