Newtonsoft or JSON.net is one of the most widely used frameworks for serializing deserializing JSON structure in a .net environment.
To start converting the data into a JSON structure, we need to create an object to store the data.
Car car = new car();
Once we have created a new object we can define/store the keys and variable in that object.
car.Brand = "Hyundai";
car.Name = “Verna”;
car.Color = “Red”;
Once all the data are stored in the defined object, then we can serialize it using SerializeObject.
string json = JsonConvert.SerializeObject(car);
The JSON structure will be stored in the string defined. The structure will be something like this:
{
"Brand":"Hyundai",
"Name": "Verna",
"Color": “Red”
}