Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to parse newLine characters in JSON string
    primarykey
    data
    text
    <p>I am trying to parse this string .... but due to <strong>"message_of_the_day" key</strong> , JSON is not able to recognize the string as it contains newLine characters (\n).How would I parse this JSON string, rest of all JSON webservices works fine for me.</p> <p><strong>Json Response :</strong></p> <pre><code>{"tblMessageOfTheDay":[{"customer_id":"1659","application_id":"1001","message_of_the_day":"Set your Message GDSFSFDS SF ADS DSFS F"}]} </code></pre> <p><strong>Code :</strong> </p> <p>I gave lot of try to solve out this issue.....but still having the same problem.</p> <pre><code>-(void)DataCollectedSuccessfully:(NSString *)responseString { NSDictionary *results = [responseString JSONValue]; // Main code .. with didn;t work id result = [responseString JSONValue]; // I tried for it, it that object won;t get recognized, but this trick didn't work. NSLog(@"%@",result); NSDictionary *results = [[responseString stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] JSONValue]; // Even tried to remove the newLine characters &amp; extra space. } </code></pre> <p><strong>Error :</strong></p> <pre><code>-JSONValue failed. Error trace is: ( "Error Domain=org.brautaset.JSON.ErrorDomain Code=5 \"Unescaped control character '0xa'\" UserInfo=0x6235db0 {NSLocalizedDescription=Unescaped control character '0xa'}", "Error Domain=org.brautaset.JSON.ErrorDomain Code=3 \"Object value expected for key: message_of_the_day\" UserInfo=0x6224a50 {NSUnderlyingError=0x6235e00 \"Unescaped control character '0xa'\", NSLocalizedDescription=Object value expected for key: message_of_the_day}", "Error Domain=org.brautaset.JSON.ErrorDomain Code=3 \"Expected value while parsing array\" UserInfo=0x6224a80 {NSUnderlyingError=0x6235d20 \"Object value expected for key: message_of_the_day\", NSLocalizedDescription=Expected value while parsing array}", "Error Domain=org.brautaset.JSON.ErrorDomain Code=3 \"Object value expected for key: tblMessageOfTheDay\" UserInfo=0x6224af0 {NSUnderlyingError=0x6224ab0 \"Expected value while parsing array\", NSLocalizedDescription=Object value expected for key: tblMessageOfTheDay}" ) </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload