⚙️ JSON to C# Classes

Updated: 2026-07-11
Ad Space - Top (728×90)

📝 Input JSON

Click "Generate" to see C# code
Ad Space - Middle (728×90)

📖 How to Use

✦ Quick Start

  1. Paste JSON string in the input area.
  2. Set the C# root class name (default: RootObject).
  3. Click "Generate" to create complete C# class definitions. All code generation happens locally in your browser.

✦ Naming Conventions

Generated C# code follows .NET naming conventions: class names and property names use PascalCase. JSON snake_case and camelCase property names are automatically converted to PascalCase. The JsonProperty attribute preserves original JSON property names for deserialization compatibility.

✦ Type Inference Rules

The tool automatically infers C# types from JSON values: string→string, number→int/long/double, boolean→bool, null→object?, array→List, object→nested class. Numeric types are selected based on value range. Empty arrays use List as default type.

✦ Newtonsoft.Json vs System.Text.Json

This tool generates code using Newtonsoft.Json's JsonProperty attribute by default. For .NET Core 3.0+'s built-in System.Text.Json, replace [JsonProperty("name")] with [JsonPropertyName("name")]. Both approaches properly deserialize JSON data.