I'm parsing json with SBJson.
I receive an error "-JSONValue failed. Error is: Unescaped control character [0x09]" when parsing my json string, it has unencoded tab. How to replace this tab in my json string to \t? If i remove tab manualy, everything is good. Or how to encode this tab properly?
Asked
Active
Viewed 5,499 times
2

Timur Mustafaev
- 4,869
- 9
- 63
- 109
-
When I convert Json to nsstring, all \n, \t, \r are hidden. how did you get them to display so you can convert them? – coolcool1994 Jun 06 '14 at 17:45
-
I am also looking for an answer to coolcool1994's question – Brian Whipp Oct 12 '16 at 18:22
1 Answers
10
You can use stringByReplacingOccurrencesOfString:withString:
:
NSString * newJsonString = [oldJsonString stringByReplacingOccurrencesOfString:@"\t" withString:@"\\t"];

MByD
- 135,866
- 28
- 264
- 277