JSON to C# Class

Updated: Oct 24, 2018

JSON to C# Class tool creates Newtonsoft annotated C# model or stub classes from JSON document. You can select the property naming convention and whether or not to annotate the properties.

Input: Paste JSON content below



Settings


Output: Generated Classes


Generate C# Class from JSON

Use this tool to quickly generate model classes for C# from a sample JSON document. The csharp model class is annotated using JsonProperty attribute supplied by Newtonsoft.

JSON

JavaScript Object Notation (JSON) pronounced as "Jason" is the de facto standard for data interchange on the web these days. It is a simple format that is easier to comprehend than XML. It also has less size than XML because of no closing tags. Interacting with JSON from JavaScript is extremely seamless.

Annotate
If selected, properties are annotated using Newtonsoft.Json's JsonProperty attribute.
Annotate On
public class Person
{
    [JsonProperty("fullName")]
    public string fullName { get; set; }

    [JsonProperty("age")]
    public int age { get; set; }
}
Annotate Off
public class Person
{
    public string fullName { get; set; }
    public int age { get; set; }
}
Property Naming Strategy
Choose the naming strategy of the generated properties. The available options are:-
Cleanse Only
public class Person
{
    [JsonProperty("Full Name")]
    public string FullName { get; set; }

    [JsonProperty("age")]
    public int age { get; set; }
}
Pascal Case
public class Person
{
    [JsonProperty("Full Name")]
    public string FullName { get; set; }

    [JsonProperty("age")]
    public int Age { get; set; }
Camel Case
public class Person
{
    [JsonProperty("Full Name")]
    public string fullName { get; set; }

    [JsonProperty("age")]
    public int age { get; set; }
}
 
Created: Sep 5, 2017
Online Tool Designed For: Windows, OS X, Android, iOS, Linux