JSON-Utils

JSON to C#

Generate C# types from a JSON sample for System.Text.Json. Every property carries a JsonPropertyName attribute with the original key, nullable fields get ? annotations, and you can choose classic classes or modern records with init only properties.

JSON
C#
Result will appear here
Ready. Press Generate or Ctrl+Enter.

How to use the JSON to C#

  1. Paste a JSON sample.
  2. Choose class or record style and a root name.
  3. Press Generate and copy the code.

Example

The tags array becomes a List of strings.

{
  "name": "json-utils",
  "version": "1.0.0",
  "private": false,
  "tags": ["json", "tools"],
  "author": { "name": "Ada", "active": true },
  "score": 9.5,
  "notes": null
}

Frequently asked questions

Does it use Newtonsoft attributes?

No, it targets the built in System.Text.Json, which is the modern default. The attribute names differ from Newtonsoft's JsonProperty.

How are numbers typed?

Whole numbers become long and decimals become double, the safe defaults when the true range is unknown.