I am sending a message from my C# Windows Service to Amazon Web Services SNS so that it can be received from an iOS application.
PublishRequest pubRequest = new PublishRequest();
pubRequest.TargetArn = arn;
pubRequest.Message = JsonConvert.SerializeObject(myMessage, Formatting.Indented);
pubRequest.MessageStructure = "json";
When I use JsonConvert.SerializeObject this produces a mesage string like so:
{"default":"My Message. ","APNS":{"aps":{"alert":{"title":"My Title","body":"MyBody data"},"data":{"someDataTolookAt":"blahblah"}}}}
BUT I need the quotes in the APNS part to be escaped like so:
{"default":"My Message. ","APNS":{\"aps\":{\"alert\":{\"title\":\"My Title\","body\":\"MyBody data\"},\"data\":{\"someDataTolookAt\":\"blahblah\"}}}}
How can I do this?