I am trying to construct JSON manually in C#.
For this I am using this string:
string Response = "{\r\n\"Token\":\"guid\"\r\n}";
But instead of this
{
"Token" :"guid"
}
I have this
"{\r\n\"Token\":\"guid\"\r\n}"
I tried Environment.NewLine also with the same results.
What is wrong?
Update
1) As the response to the request I can send different answers: "Token" or "Request". I don't want no make this:
if(true) Result = Json(new { Token= "guid"});
else Result = Json(new { Request = "data array"});
2) it is web api function. I need to have the "good" result on the browser site
public IHttpActionResult Logon([FromBody]Logon_Request model)
{
//some logic
string Response_Type=...;
string Response_Value=...;
string Response = "{\r\n\"" + Response_Type + "\":\"" + Response_Value + "\"\r\n}";
IHttpActionResult Result = Ok(Response);
return Result;
}