objective c - Changing the JSON string Format -
how change following json structure,
[ "registerdevice", { "type": "7", "pushbadge": "1", "pushsound": "1", "enabled": "1", "devicetoken": "e03d25f4f1bd40678cd693fe66fe7946ffdb03e1b23cfc5f9dc747fd5869fbcd", "pushalert": "1" } ]
to format using objective-c
@"[\"registerdevice\",{\"type\":\"7\",\"pushbadge\":\"1\",\"pushsound\":\"1\",\"enabled\":\"1\",\"devicetoken\":\"e84ab955cd3b9af439f1567b9f80e70d52d3b0209151fe9b3392efc8af9f5e1f\",\"pushalert\":\"1\"}]";
try this,
yoursting=[yourstring stringbyreplacingoccurrencesofstring@"\"" withstring:@"\\\""];
Comments
Post a Comment