I have the following customer class in c#:
class Customer
{
public int CustomerID;
public string Name;
}
I am trying to convert the class object to Json string using Newtonsoft.Json:
Customer c = new Customer();
c.CustomerID = 1;
c.Name = "Test";
string jsonString = JsonConvert.SerializeObject(obj);
It generates:
{"CustomerID": 1, "Name": "Test"}
Is it possible to wrap Customer ID to double quotes (without changing CustomerID data type from int to string)?
{"CustomerID": "1", "Name": "Test"}