JSON to C#

Paste JSON and instantly get matching C# class definitions with public properties and nested classes.

Use the JSON to C#

Input JSON

C# Output

Paste JSON and click Generate

Copied!

Summary

JSON to C# reads a JSON value and generates matching C# class definitions, including public auto-implemented properties and separate classes for nested objects. When an array of objects is scanned, properties are gathered across every item so the generated class covers keys that only appear on some entries. Property names are converted to PascalCase and a JsonPropertyName attribute is added whenever the property name differs from the original JSON key, so System.Text.Json can still deserialize the original payload correctly.

How it works

  1. Paste or type JSON into the input panel, or load a sample.
  2. Set a root class name (defaults to RootObject).
  3. Click Generate to parse the JSON and build C# classes.
  4. Nested objects become their own named classes; arrays of objects are scanned across all items to collect every property.
  5. Review the generated classes, each with public auto-properties, in the output panel.
  6. Click Copy to copy the C# code to your clipboard.

Use cases

  • Scaffold a POCO for an incoming REST API response before writing a deserializer.
  • Turn a sample config file into a typed C# settings class.
  • Generate a starting class for System.Text.Json or Newtonsoft.Json without typing every property by hand.
  • Document a third-party API response shape as C# types.
  • Speed up building a .NET client for an API that only ships JSON examples.
  • Check property naming and nesting before hand-writing a data model.

Frequently Asked Questions

Last updated: 2026-07-13 · Reviewed by Nham Vu