JSON to C# Class
Generate C# classes for System.Text.Json or Newtonsoft from any JSON. Nullable types detected.
Runs in your browser. Nothing is uploaded.
Input
Waiting for JSON
C#
C# types appear here.What this does
Paste JSON and get C# classes with auto-properties, annotated for System.Text.Json ([JsonPropertyName]) or Newtonsoft.Json ([JsonProperty]). Nested objects become their own classes; arrays of objects are merged into one class.
Types
Whole numbers are long, decimals double. A key that is missing from some items, or sometimes null, gets a nullable type such as string? or long?. Arrays are List<T>; empty arrays and mixed values are object.
Names
Properties are PascalCase and the original key is always kept in the attribute, so first-name maps to FirstName. Two objects with the same shape share one class.
More json tools
All- JSON to TypeScriptTurn any JSON into TypeScript interfaces. Nested types named, optional keys detected.
- JSON to Go StructGenerate Go structs with json tags from any JSON. Nested structs named, pointers for nullable values.
- JSON to Kotlin Data ClassGenerate Kotlin data classes from JSON, for kotlinx.serialization, Gson, or plain Kotlin.
- JSON to Java ClassGenerate Java records or POJO classes with Jackson annotations from any JSON.
- JSON to Python DataclassGenerate Python dataclasses, Pydantic models, or TypedDicts with type hints from any JSON.
- JSON to Dart ClassGenerate null-safe Dart classes with fromJson and toJson from any JSON. Made for Flutter.
- JSON to Swift CodableGenerate Swift Codable structs with CodingKeys from any JSON.
- JSON to Rust StructGenerate Rust structs with serde derives and Option fields from any JSON.