I am receiving from another website a curl request with json.
An example request would be
curl -X PUT -H "Content-Type: application/json" -d '{"c_id":"487672","amount":10}' http:
This is just some test code to try and see the values...
[HttpPut]
public void Confirmation(HttpRequestMessage request)
{
var content = request.Content;
string jsonContent = content.ReadAsStringAsync().Result;
CreateUpdate cpu = JsonConvert.DeserializeObject<CreateUpdate>(jsonContent);
string acuid = cpu.c_id;
return;
}
If I run using the above curl the value of the jsonContent string is
'{c_id:487672,amount:10}'
And as a result the code breaks and the acuid string is not populated.
What I have tried:
As a test I changed the curl to
curl -X PUT -H "Content-Type: application/json" -d "{'c_id':'487672','amount':10}' http://xxxx/api/b2
i.e. replacing the double quotes with single quotes.
{'c_id':'487672','amount':10}
This time my acuid variable is populated correctly.
My question is, what do I need to do to allow the original curl to be read without losing it's quotes.