JSON to C# Class

Generate C# classes or records from JSON with JsonPropertyName or JsonProperty attributes, for .NET, Unity and Xamarin.

Runs in your browser. Your data never leaves your device.

How to use the JSON to C# Class

  1. Paste a sample JSON.
  2. Choose the serializer and class or record.
  3. Copy the C# code.

About this tool

Convert a JSON sample into C# classes with PascalCase properties. Add [JsonPropertyName] for System.Text.Json or [JsonProperty] for Newtonsoft.Json so the JSON keys still match, and choose classes or records.

Frequently asked questions

Which attribute do I need?

Use JsonPropertyName with System.Text.Json (built into .NET) and JsonProperty with Newtonsoft.Json.

More json tools

JSON and code models

All 31 free tools →
JSON tool · Runs in your browser

JSON Formatter

Format JSON online: beautify messy JSON with 2 or 4 spaces or tabs, sort keys, minify it to one line and find errors. Free, runs in your browser.

Free · No sign-upOpen tool
JSON tool · Runs in your browser

JSON Validator

Check if JSON is valid and see the exact line and column of any error, with a hint on how to fix it. A free online JSON validator in your browser.

Free · No sign-upOpen tool
JSON tool · Runs in your browser

JSON to Kotlin Data Class

Paste JSON and get Kotlin data classes for Android, with kotlinx.serialization, Gson or Moshi names, nullable fields and defaults. Free, in your browser.

Free · No sign-upOpen tool
JSON tool · Runs in your browser

JSON to Dart (Flutter)

Convert JSON to null-safe Dart model classes for Flutter, with fromJson, toJson and an optional copyWith. Free, no sign-up, runs in your browser.

Free · No sign-upOpen tool