简体   繁体   中英

Weird Response JSON on iPhone (and iPhone simulator) only

I send a list over JSON to my server where it updates it and sends me back the updated list. But when I receive the response I get back some weird JSON:

ResponseString from Server: {"d":"{\\"basketList\\":[{\\"amount\\":1,\\"strikethrough\\":0,\\"listName\\":\\"default\\",\\"listID\\":\\"00000000-0000-0000-0000-000000000000\\",\\"TimeStamp\\":\\"10/10/01 09:17:08\\",\\"id\\":\\"4116858a-374b-489b-ae26-5175b7b7b0f9\\",\\"thumb\\":\\"http://mobile.boxolino.com/test/60aee80d-ad31-49b1-9895-4984fa348624_56x56.png\\",\\"name\\":\\"0,5L ROOMIJS CHOCOLADE\\",\\"image\\":\\"\\",\\"type\\":\\"product\\",\\"isPromo\\":0,\\"inList\\":1,\\"rotatorImage\\":\\"\\",\\"expiration\\":\\"01/01/10\\",\\"brand\\":\\"\\",\\"enseigne\\":\\"\\",\\"branch\\":\\"\\",\\"branchID\\":\\"00000000-0000-0000-0000-000000000000\\"},{\\"amount\\":1,\\"strikethrough\\":0,\\"listName\\":\\"default\\",\\"listID\\":\\"00000000-0000-0000-0000-000000000000\\",\\"TimeStamp\\":\\"10/10/01 09:17:08\\",\\"id\\":\\"4fbc4d31-ca2a-4001-942b-6da270de7eb4\\",\\"thumb\\":\\"http://mobile.boxolino.com/test/60aee80d-ad31-49b1-9895-4984fa348624_56x56.png\\",\\"name\\":\\"Biokatoenen washandjes 4 stuks - 16 x 21 cm\\",\\"image\\":\\"\\",\\"type\\":\\"product\\",\\"isPromo\\":0,\\"inList\\":1, \\"rotatorImage\\":\\"\\",\\"expiration\\":\\"01/01/10\\",\\"brand\\":\\"\\",\\"enseigne\\":\\"\\",\\"branch\\":\\"\\",\\"branchID\\":\\"00000000-0000-0000-0000-000000000000\\"},{\\"amount\\":14,\\"strikethrough\\":0,\\"listName\\":\\"default\\",\\"listID\\":\\"00000000-0000-0000-0000-000000000000\\",\\"TimeStamp\\":\\"10/10/01 09:17:08\\",\\"id\\":\\"e410e57c-2d0b-4486-98f8-a350490eab85\\",\\"thumb\\":\\"http://mobile.boxolino.com/test/60aee80d-ad31-49b1-9895-4984fa348624_56x56.png\\",\\"name\\":\\"Parelhoen prijs/kg\\",\\"image\\":\\"\\",\\"type\\":\\"product\\",\\"isPromo\\":0,\\"inList\\":14,\\"rotatorImage\\":\\"\\",\\"expiration\\":\\"01/01/10\\",\\"brand\\":\\"\\",\\"enseigne\\":\\"\\",\\"branch\\":\\"\\",\\"branchID\\":\\"00000000-0000-0000-0000-000000000000\\"},{\\"amount\\":1,\\"strikethrough\\":1,\\"listName\\":\\"default\\",\\"listID\\":\\"00000000-0000-0000-0000-000000000000\\",\\"TimeStamp\\":\\"10/10/01 09:17:08\\",\\"id\\":\\"7798392f-d47d-48b1-a368-c3d65dcb1523\\",\\"thumb\\":\\"http://mobile.boxolino.com/test/60aee80d-ad31-49b1-9895-4984fa348624_56x56.png\\",\\"name\\":\\"6 WASHAN DJES +KAART M.BLAUW\\",\\"image\\":\\"\\",\\"type\\":\\"product\\",\\"isPromo\\":0,\\"inList\\":1,\\"rotatorImage\\":\\"\\",\\"expiration\\":\\"01/01/10\\",\\"brand\\":\\"\\",\\"enseigne\\":\\"\\",\\"branch\\":\\"\\",\\"branchID\\":\\"00000000-0000-0000-0000-000000000000\\"},{\\"amount\\":7,\\"strikethrough\\":0,\\"listName\\":\\"default\\",\\"listID\\":\\"00000000-0000-0000-0000-000000000000\\",\\"TimeStamp\\":\\"10/10/01 09:17:08\\",\\"id\\":\\"2e3040a1-2c6e-469c-8f09-d4bc58eda5df\\",\\"thumb\\":\\"http://mobile.boxolino.com/test/60aee80d-ad31-49b1-9895-4984fa348624_56x56.png\\",\\"name\\":\\"Hydraterend scheerapparaat HS8420\\",\\"image\\":\\"\\",\\"type\\":\\"product\\",\\"isPromo\\":0,\\"inList\\":7,\\"rotatorImage\\":\\"\\",\\"expiration\\":\\"01/01/10\\",\\"brand\\":\\"\\",\\"enseigne\\":\\"\\",\\"branch\\":\\"\\",\\"branchID\\":\\"00000000-0000-0000-0000-000000000000\\"},{\\"amount\\":1,\\"strikethrough\\":0,\\"listName\\":\\"default\\",\\"listID\\":\\"00000000-0000-0000-0000-000000000000\\",\\"TimeStamp\\":\\"10/10/01 09:17:08\\",\\"id\\":\\"fccf42c8-8c86-43b7-aca7-df05dd3cf85f\\",\\"thumb\\":\\"ht tp://mobile.boxolino.com/test/60aee80d-ad31-49b1-9895-4984fa348624_56x56.png\\",\\"name\\":\\"Varkensgebraad prijs/kg \\",\\"image\\":\\"\\",\\"type\\":\\"product\\",\\"isPromo\\":0,\\"inList\\":1,\\"rotatorImage\\":\\"\\",\\"expiration\\":\\"01/01/10\\",\\"brand\\":\\"\\",\\"enseigne\\":\\"\\",\\"branch\\":\\"\\",\\"branchID\\":\\"00000000-0000-0000-0000-000000000000\\"},{\\"amount\\":4,\\"strikethrough\\":0,\\"listName\\":\\"default\\",\\"listID\\":\\"00000000-0000-0000-0000-000000000000\\",\\"TimeStamp\\":\\"10/10/01 09:17:08\\",\\"id\\":\\"cfcdd1e9-cd52-4884-9cf0-e54f98f33c2f\\",\\"thumb\\":\\"http://mobile.boxolino.com/test/60aee80d-ad31-49b1-9895-4984fa348624_56x56.png\\",\\"name\\":\\"Rok met print mt 36-46\\",\\"image\\":\\"\\",\\"type\\":\\"product\\",\\"isPromo\\":1,\\"inList\\":4,\\"rotatorImage\\":\\"\\",\\"expiration\\":\\"01/01/10\\",\\"brand\\":\\"\\",\\"enseigne\\":\\"\\",\\"branch\\":\\"Rokken\\",\\"branchID\\":\\"f49ac233-5d53-4340-8b89-cae9a285c032\\"}]}"}

The normal output should be without that "d" and all the backslashes...

Any idea what is going on?

How I got this output:

NSString *responseString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
    NSLog(@"ResponseString from Server: %@",responseString);

Thanks in advance,

Lewion

It is probably related to the son module in the server and not the son module in the iPhone.

There are many ways to solve it. For example: 1. Replace the \\" with " and after getting the JSON object get the value of the key "d" as the final object, 2. Try looking on the son module in the server and either try to config it to have a different configuration or replace it with a better one.

If you need help on the second option you'll need to post more data related to the server.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM