JSON to C#

Generate typed C# classes with PascalCase properties from a sample JSON document.

Generate C# classes

Result: —
Class names come from the key path, arrays are detected and objects that share a shape are merged into one class.

How to use the JSON to C#

  1. Paste a JSON sample into the input box.
  2. Set the root class name you want in your project.
  3. Click Generate classes and copy the C# code.

Features

Advertisement

Frequently Asked Questions

Common questions about the free online json to c#.

Paste a JSON sample, set the root class name and click Generate classes. The tool infers one class per object shape with typed properties.
Keys are converted to PascalCase, so a key such as first name becomes the property FirstName with a public get and set accessor.
An array of objects becomes a List of the matching class and an array of strings becomes a List of string, with the generic namespace imported.
Every nested object becomes its own class named after the key path, so an address inside a user object produces a class called UserAddress.
A field that can be null becomes a nullable value type such as int with a question mark, while text and object fields stay reference types.
No. The output is a plain set of classes, and you can wrap it in your own namespace before compiling it in your project.
No. Generation runs entirely in your browser, so your sample document never leaves your device.
Text that is not valid JSON, or a sample that is not an object or an array, produces a clear error message instead of code.

Last updated: October 10, 2026