I have a aspnet web api that returns json using this code:
Project_Model mdl = new Project_Model(transactionId, data);
string json = string.Empty;
json = JsonConvert.SerializeObject(mdl);
and this is the value of the variable “json”:
{\"Pj_Id\":\"23a6bd47-c35a-4ee3-8998-bd0406bc5839\",\"Pj_CUsr_Id\":\"8cb52c3e-25b7-412d-8010-cadd75f1f64b\",\"Pj_Number\":\"test 101\",\"Pj_Name\":\"Test Project 101\",\"Pj_Location\":\"1551 Main St, Houston\"}
But it should look like this:
{
"Pj_Id": "23a6bd47-c35a-4ee3-8998-bd0406bc5839",
"Pj_CUsr_Id": "8cb52c3e-25b7-412d-8010-cadd75f1f64b",
"Pj_Number": "test 101",
"Pj_Name": "Test Project 101",
"Pj_Location": "1551 Main St, Houston"
}
I know we will get escape characters like this in the debugger but not in the output. The example above with the backslashes was copied from PostMan’s output of the same API.
Can someone please tell me why this is happening and what can be done to clean it up?
Thanks.