JSON to C# Class

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.

Converted on ToolSlick's server. Your input and its output are not stored.

Paste JSON content below
Generated Classes

Settings

How the input is converted. Each is explained below.

History

  • 2018-01-18Assumed data type to be string in case of empty arrays
  • 2017-09-05Tool Launched

Settings explained

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; }
}

Background

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 most common data interchange format on the web. Douglas Crockford first released the JSON specification in the early 2000s. It is a simple format that is easier to comprehend than XML. It is also smaller in size because it does not have closing tags. A wide variety of programming languages can parse JSON files. They also support the serialization of data structures to JSON. You can copy JSON text to JavaScript and start using them without any modifications.

Related tools