JSON stands for JavaScript Object Notation · JSON is a lightweight open standard file format and data interchange format that uses human-readable text to store and transmit data objects consisting of attribute–value pairs and arrays.
Step 1 : Copy and paste the JSON string
Make sure that the JSON string is well formatted. The JSON object should be wrapped with curly braces and should not be escaped by backslashes.
Sample JSON:
{
employee:
{
id:1001,
dob: "11/16/1982",
fullName:
{
firstName: "Venkat",
lastName:"Cherukuru",
middleName:"C"
},
country: "India",
aliasNames: [ "Venkat", "Venki", "Cherukuri" ],
favouriteNums: [7, 9, 11]
},
certifications:
[
{
name:"AZ-900",
desc:"Azure Fundamentals",
date:"1/10/2021"
},
{
name:"DP-100",
desc:"Data Science Associate",
date:"7/4/2021"
}
]
}
Step 2 : Click on Convert button to generate C# classes.
Click the convert button and wait a few seconds until your C# classes appear.
Step 3 : Copy the generated C# classes.
When you copy the returned classes in the directory of your solution, you can deserialize your JSON response using the 'Root' class using any deserializer like Newtonsoft.
C# Classes for above sample JSON:
public class
Root
{
public
Employee
employee {
get;
set; }
public
List<Certification> certifications {
get;
set; }
}
public class
Employee
{
public
int
id {
get;
set; }
public
DateTime
dob {
get;
set; }
public
FullName
fullName {
get;
set; }
public
string
country {
get;
set; }
public
string[] aliasNames {
get;
set; }
public
int[] favouriteNums {
get;
set; }
}
public class
FullName
{
public
string
firstName {
get;
set; }
public
string
lastName {
get;
set; }
public
string
middleName {
get;
set; }
}
public class
Certification
{
public
string
name {
get;
set; }
public
string
desc {
get;
set; }
public
DateTime
date {
get;
set; }
}