JSON → C# classes
ClientInfer property types from a JSON sample. Adjust names and numeric types before shipping.
Learn more: JSON and C#
Paste a sample JSON object to generate C# class declarations that match its shape—useful as a starting point for models you will deserialize with System.Text.Json, Newtonsoft.Json, or similar.
JSON in .NET
In C#, you usually deserialize JSON into instances of classes or records (often called POCOs—Plain Old CLR Objects). Property names in JSON map to C# properties; numbers and booleans map to appropriate value types.
From sample to code
A single JSON example does not prove every future payload will look the same, but it captures field names and nesting for a first draft. You may rename types, switch `double` to `decimal` for money, or add nullability once you know your API contract.
Not the reverse direction
This tool generates C# from JSON. Turning arbitrary C# types back into JSON schema examples is a different workflow (serialization from live objects or source generators)—use your project’s serializer for that.
JSON → C#
?
Parses JSON in your browser and emits classes inferred from the sample shape. Nested objects become nested types; arrays use the first element only to guess item shape. Nothing is uploaded.
Rename types, tighten numeric types, and add annotations for your serializer (System.Text.Json, etc.) as needed.
Common use cases
- Scaffold POCOs for System.Text.Json or Newtonsoft from sample API responses.
- Align JsonPropertyName attributes with camelCase JSON from ASP.NET clients.
- Preview nullable reference types for nullable JSON fields.
Common mistakes to avoid
Using double for currency or precise decimals
Switch to decimal when JSON represents money or requires exact base-10 math.
Ignoring case sensitivity and naming policies
Configure JsonSerializerOptions to match your API’s casing; generated names are a baseline.
FAQ
Is C# generation performed locally?
Yes. JSON is processed only in your browser.
Does this emit records or init-only properties?
Output is simple class-style scaffolding. Refactor to records or init accessors to match your style.
More tools
Related utilities you can open in another tab—mostly client-side.
JSON → Java classes
ClientPOJO-style fields and List types from JSON.
JSON → Python TypedDict
ClientTypedDict scaffolding from sample JSON—nested shapes inferred in the browser.
JSON → Rust structs (serde)
ClientSerde structs with JSON renames from sample data—local only.
YAML ↔ JSON
ClientYAML to JSON and JSON to YAML online—format, validate, convert locally.