I am having a sample code which helps me to print the JSON response. In this I manually added the \ slash symbol before keys and values so it helps me to print the JSON . The code is :
NSString *jsonString = @"[{\"person\": {\"name\":\"James\",\"age\":\"24\"}},{\"person\": {\"name\":\"ray\",\"age\":\"70\"}}]";
Now the problem is once the JSON string gets longer I have to manually add the \ before every key.
Can someone help of how I can add "" before the keys as shown in the code above using some looping code?
Any help will be appreciated.
It's really not clear what you're trying to do - but maybe this will work...
Use:
The
targetwill be", and you'll need to escape it like this:The
replacementwill be\", escaped like this:So, this:
will output this to the debug console:
When receiving json from remote, it might look like this: