JSON to C Sharp POJO Generator
Paste JSON and generate Newtonsoft.Json C# POCO classes with JsonProperty attributes in your browser.
Generate strongly typed C# POCO (Plain Old CLR Object) classes from any JSON payload without leaving your
browser. The generator walks the parsed JSON tree, infers primitive types (bool, long,
double, string), and emits one class per nested object with
[JsonProperty] attributes so deserialisation with Newtonsoft.Json preserves the original property
names.
Why infer C# models from JSON?
- REST API consumers: Drop sample responses to scaffold the DTOs your
HttpClientwill deserialise. - Migration spikes: Translate sample documents from Mongo, DynamoDB, or vendor exports into POCOs as a starting point.
- Teaching: Show students how JSON shapes map to PascalCase C# properties.
- Code review aid: Compare hand-written models against an automated baseline.
How types are inferred
- JSON booleans become
bool. - JSON numbers map to
longwhen they are integers anddoubleotherwise. - JSON strings map to
string. - Arrays become
List<T>whereTis inferred from the first non-null element. Empty arrays default toList<object>. - Nested objects become their own classes named after the parent path in PascalCase. Duplicate class names get a numeric suffix to avoid collisions.
If you start with a JSON array at the root level the generator wraps it in a synthetic Items
property so the resulting model is still a class you can deserialise directly.
Frequently Asked Questions
Which JSON library do the attributes assume?
Newtonsoft.Json (Json.NET). If you prefer System.Text.Json, replace
[JsonProperty] with [JsonPropertyName] and the matching namespace import after
pasting the output into your project.
How are nullable fields handled?
Fields whose only sampled value is null become object. Adjust to
nullable types like int? or string? once you know the real schema.
What about really large numbers?
Integers map to long by default, which handles values up to 9,223,372,036,854,775,807.
For unbounded numerics swap the type for decimal or System.Numerics.BigInteger
where needed.
Does my JSON leave the browser?
No. Parsing and code generation happen entirely on your device. Nothing is uploaded.
Related tools
Your recent visits