I have the following JSON string that is passed into my c# code as a string parameter - AddLocation(string locationJSON):
{\"accountId\":\"57abb4d6aad4\",\"a
I've ran into this problem as well. Try something like this instead of AddJsonBody
.
request.AddParameter("application/json", locationJSON, ParameterType.RequestBody);
I have tried like this and it working fine, Add Bearer with token
request.AddHeader("cache-control", "no-cache");
request.AddHeader("authorization", "Bearer " + "your token key");
request.AddHeader("accept", "application/json");
This should work:
request.AddParameter("application/json; charset=utf-8", JsonConvert.SerializeObject(yourObject), ParameterType.RequestBody);
If you directly add the serialized object, the problem is the Json convert is adding "\" before each ".