JSON to C#

Generate C# classes or records from JSON for System.Text.Json or Newtonsoft

How to use

  1. Paste your JSON object or array of objects into the input pane.
  2. Choose class or record output style.
  3. Pick the serializer: System.Text.Json (JsonPropertyName) or Newtonsoft (JsonProperty).
  4. Copy the generated classes; nested objects arrive as separate top-level classes.

About this tool

This converter targets .NET teams consuming REST APIs. It generates the boilerplate: PascalCase property names, serializer attributes mapping back to the original JSON keys, and List<T> collections. Record mode gives you immutable DTOs with init-only setters, matching modern C# codebase style.

Frequently asked questions

Why JsonPropertyName attributes?

C# properties are PascalCase by convention while JSON keys are usually camelCase or snake_case. The attribute maps between them so the serializer round-trips correctly without global naming policies.

How are nulls handled?

Reference-type properties stay nullable by default. Value-type properties (long, double, bool) for fields that can be absent or null may need long?/double? — adjust after pasting if your source data has nulls there.

Are collection types supported?

Yes, JSON arrays map to List<T> with T inferred from the elements, including nested objects which become their own classes.

Is my data uploaded anywhere?

No. All conversion runs in your browser; nothing is transmitted.

Related tools