Omnikit
DevFilesMoneyAll tools
Ctrl K
Dev toolsFile toolsMoney calculatorsAll tools
HomeDeveloper toolsJSON to C# Class ConverterJSON to C# for Newtonsoft.Json

JSON to C# for Newtonsoft.Json

dev

Paste JSON and get C# classes with [JsonProperty] attributes for Json.NET

Runs in your browser. Nothing you type is sent anywhere. Checked against sources on 16 Oct 2026.

Projects on Json.NET read JSON with JsonConvert.DeserializeObject, and each property needs a [JsonProperty("key")] attribute when the C# name differs from the key. Paste a sample and get classes written for Newtonsoft.Json: PascalCase properties, the original key in every attribute, int, long or double per field, and nullable types wherever the sample shows null or leaves a key out.

Next:
  • JSON to TypeScript Generate TypeScript interfaces or types from a JSON sample
  • JSON Formatter & Validator Format, validate, minify and sort JSON with exact error positions

How to use JSON to C# for Newtonsoft.Json

1

Paste or type your input.

2

Choose the options you need.

3

Press Ctrl+Enter, then copy or download.

How JSON to C# for Newtonsoft.Json works

C# reads JSON into typed classes, and each property needs the right type and a way to find its key. This converter writes those classes from a sample, so a long API response becomes a compiling model in one paste.

JSON value C# type
"text" string
true / false bool
42 (whole numbers only) int, or long beyond 32 bits
4.5 (any decimal seen) double
null, and also a type int?, string?
only null, or mixed kinds object?
[ ... ] List<...>
{ } empty Dictionary<string, object>
{ ... } a class of its own

Keys and names. Properties are PascalCase, so user_name becomes UserName and avatar_url AvatarUrl. Every property carries its original key in an attribute, because System.Text.Json matches names case-sensitively unless told otherwise; Newtonsoft gets [JsonProperty] instead. A property that would share its class's name, which the compiler rejects as CS0542, gets Value added.

The rest of the article, and all 6 questions about JSON to C# Class Converter, are on the JSON to C# Class Converter page.

Frequently asked questions

How do I convert JSON to a C# class?

Paste a JSON sample into the converter and the C# classes appear beside it, one per object, with a JsonPropertyName attribute on every property. Copy them into your project and read the JSON with JsonSerializer.Deserialize<Root>(json), or JsonConvert.DeserializeObject<Root>(json) when Newtonsoft is chosen.

Why does every property have a JsonPropertyName attribute?

System.Text.Json matches property names case-sensitively by default, so a property called UserName would never receive the key user_name. The attribute names the exact key, which keeps C# naming in PascalCase and still reads the JSON without any serializer options or naming policy.

Should I use classes or records?

Records with init accessors suit models you only read, because their properties cannot change after deserialization and two records with the same values compare equal. Classes with set suit models you fill in or edit. Both work with System.Text.Json from .NET 5 and with Newtonsoft.Json.

How are numbers typed in C#?

Whole numbers become int, or long when a value is beyond 2,147,483,647, and a field becomes double as soon as any sample value has a decimal part. Values of different kinds, such as a number in one item and text in another, become object?, which keeps the raw JSON value.

Sources

  • Microsoft Learn, System.Text.Json: customize property namesJsonPropertyName, and case-sensitive matching by default
  • Newtonsoft.Json documentation, JsonPropertyAttribute nameJsonProperty("key") on a property
  • Microsoft Learn, .NET naming guidelinesPascalCase types and properties
  • Microsoft Learn, compiler error CS0542A member cannot have the same name as its enclosing type

Last verified 16 October 2026.

Rates and rules change; check the source before you rely on a figure.

Still stuck? Ask about JSON to C# Class Converter and anybody who knows can answer. No account needed.

More ways to use JSON to C# Class Converter

  • JSON to C# Class ConverterTurn a JSON sample into C# classes or records for System.Text.Json or Newtonsoft.Json

Same job, other tools: TSV to JSON – Convert tab-separated values, such as a paste from Excel, into JSON · JSON to YAML – Turn JSON into clean, readable YAML for configs · Query String Parser – Split a URL query string into a table of decoded parameters.

Related tools

All developer tools
Base64 Encode & DecodeText and files to Base64 and back, with URL-safe mode and image previewUnix Timestamp ConverterUnix timestamps to dates and dates to timestamps, in any time zoneJSON to TypeScriptGenerate TypeScript interfaces or types from a JSON sampleCSV to JSONConvert CSV to JSON and JSON to CSV, with a table previewYAML to JSONConvert YAML to JSON and JSON to YAML, with anchors resolvedURL Encoder / DecoderPercent-encode or decode text and URLs, and see every part of a linkColor ConverterHEX, RGB, HSL, HWB, OKLCH and CMYK in both directions, with a contrast checkNumber Base ConverterBinary, octal, decimal, hex and any base to 36, exact at any size, with two's complement
Was this tool helpful?
Omnikit

Small jobs, done in your browser. Free, fast and private. Files are never uploaded.

Files

  • Compress Image
  • Image to PDF
  • Merge PDF
  • Compress PDF
  • PDF to Word
  • Word to PDF

Dev

  • JSON Formatter & Validator
  • Base64 Encode & Decode
  • JWT Decoder, Verifier & Encoder
  • Password Generator
  • UUID Generator
  • Unix Timestamp Converter

Money

  • SIP Calculator
  • EMI Calculator
  • GST Calculator
  • FD Calculator
  • PPF Calculator
  • Lumpsum Calculator
GuidesQuestionsAboutHow we checkLaw library (beta)PrivacyTermsDisclosureContactMore: Exam practice (UGC NET Paper 1)Runs in your browser. Nothing is uploaded. © 2026 Omnikit (theomnikit.com)