Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Replace tab in NSString with \t

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?

like image 253
Timur Mustafaev Avatar asked May 12 '26 22:05

Timur Mustafaev


1 Answers

You can use stringByReplacingOccurrencesOfString:withString::

NSString * newJsonString = [oldJsonString stringByReplacingOccurrencesOfString:@"\t" withString:@"\\t"];
like image 66
MByD Avatar answered May 15 '26 11:05

MByD



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!