Data & JSON
JSON Formatter
Beautify, minify, validate, and sort JSON with clear, line-aware error reporting.
Code generation
Generate clean C# classes from JSON, including nested objects, arrays, and nullable values.
This tool runs entirely in your browser. Nothing you paste or upload is sent to our servers.
Characters: 0
Characters: 0
Root type: —
No model classes are required for this root value.
Invalid characters are converted into a valid C# class name.
Adds #nullable enable and nullable annotations for reference types.
Paste a JSON object or array into the input editor, or load the sample. Everything stays in your browser.
Set the root class name, property naming, nullable reference types, collection style and serialization attributes.
Select Generate C#. The generator merges object shapes, handles nulls and missing fields, and avoids duplicate class names.
Copy the generated C# or download it as a .cs file, then add a namespace and adjust the serializer setup for your project.
JSON
{
"user": {
"id": 1,
"name": "Ada"
}
}Generated C#
// Generated by DevDataKit JSON to C# Class Generator.
// Root type: Root
#nullable enable
using System.Text.Json.Serialization;
public sealed class Root
{
[JsonPropertyName("user")]
public User User { get; set; } = null!;
}
public sealed class User
{
[JsonPropertyName("id")]
public int Id { get; set; }
[JsonPropertyName("name")]
public string Name { get; set; } = null!;
}
This small example shows how the JSON user object becomes a root class with a nested User class.
This tool parses a JSON document, infers the shape of its objects and arrays, and emits C# model classes. It is useful for creating DTOs for APIs, configuration payloads and integration tests without writing boilerplate by hand.
Generation is a static analysis of the JSON structure. It does not run or evaluate the input, and generated classes are a starting point for your project rather than a complete application layer.
Each JSON property becomes a public C# property. PascalCase creates conventional C# names, while Original JSON names keeps the input spelling where it is a valid identifier.
Reserved keywords are escaped, invalid characters are sanitized, and naming collisions receive deterministic numeric suffixes. Serialization attributes preserve the original JSON name whenever the C# identifier differs.
A property is nullable when it is explicitly null or missing from at least one object in an array. Value types use nullable forms such as int?, while reference types use string? or Class? when Nullable Reference Types is enabled.
With Nullable Reference Types on, the output includes #nullable enable and non-null reference initializers where appropriate. Turn the option off when your project uses the older nullable-disabled context.
Nested objects become separate classes. Arrays of objects generate a class for the element shape, and arrays of primitives use List<T> or T[]. Nested arrays produce nested collection types.
When objects in an array have different properties, the shapes are merged and absent fields become nullable. Identical object shapes reuse one class, and class-name collisions receive a safe numeric suffix.
System.Text.Json uses JsonPropertyName attributes from System.Text.Json.Serialization. Newtonsoft.Json uses JsonProperty attributes from the Newtonsoft.Json namespace.
Choose the serializer already used by your application. The generated using directive and attributes match the selection; attributes are only added when the C# name would otherwise differ from the JSON name.
The generator is useful when integrating with a new API, creating typed request and response models, exploring a JSON payload, building configuration classes, or producing quick DTOs for a .NET application.
Review generated code before production use: add a namespace, configure your serializer, decide whether to use records or classes, and check how your application represents dates, decimals and unknown values.
The generator emits standard C# classes and attributes. Representative outputs are compiled with the .NET SDK during development. You still need to add an appropriate namespace, project target and serializer package/settings for your application.
PascalCase converts names such as user_name to UserName. Original JSON names preserves valid names. When the generated identifier differs from the JSON name, a JsonPropertyName or JsonProperty attribute preserves the original name.
A property is nullable when its value is null or when it is missing from some objects in an array. Nullable value types use ?, and nullable reference types use ? when Nullable Reference Types is enabled. The option also controls the #nullable directive and non-null initializers.
Nested objects become separate classes. Arrays of objects generate an element class; primitive arrays use List<T> or T[], and nested arrays become nested collections. Object shapes in an array are merged so fields from every object are retained.
Arrays containing different object shapes are merged into one class with nullable properties. Arrays mixing objects and primitive values use object, because a single strongly typed element cannot represent both without discarding data.
Choose System.Text.Json when your project uses System.Text.Json, or Newtonsoft.Json when it uses Newtonsoft. The generated attributes and using directive match the selected option. Attributes are only emitted where needed.
No. JSON parsing, type inference, C# generation, copying and downloading all happen locally in your browser.
Yes. For a top-level array of objects, the root class represents the array element and the displayed root type is the collection type. For primitive roots, no model classes are required.
Data & JSON
Beautify, minify, validate, and sort JSON with clear, line-aware error reporting.
Date & time
Convert Unix timestamps to dates and dates to timestamps across UTC and selected time zones.