J'envoie une liste sur JSON à mon serveur où elle le met à jour et me renvoie la liste mise à jour. Mais quand je reçois la réponse que je reviens un peu JSON bizarre:Réponse bizarre JSON sur iPhone (et simulateur d'iPhone) seulement
ResponseString du serveur: { "d": "{\" basketList \ ": [{\" quantité \ ": 1, \" biffés \ ": 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 \ ", \" nom \ ": \" 0,5L ROOMIJS CHOCOLADE \ ", \" image \ ": \" \ ", \" type \ ": \" produit \ ", \ "isPromo \": 0, \ "inList \": 1, \ "image_rotation \": \ "\", \ "expiration \": \ "01/01/10 \", \ "marque \": \ "\", \ "enseigne \": \ "\", \ "branche \": \ "\", \ "identificateur de branchement \": \ "00000000-0000-0000-0000-000000000000 \"}, {\ " amount \ ": 1, \" barré \ ": 0, \" listName \ ": \" par défaut \ ", \" 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 \ ", \" nom \ ": \ "Biokatoenen washandjes 4 stuks - 16 x 21 cm \", \ "image \": \ "\", \ "type \": \ "produit \", \ "isPromo \": 0, \ "inList \": 1, \ "rotatorImage \": \ "\", \ "expiration \": \ "01/01/10 \", \ "marque \": \ "\", \ "enseigne \": \ "\" , \ "branch \": \ "\", \ "branchID \": \ "00000000-0000-0000-0000-000000000000 \"}, {\ "montant \": 14, \ "barré \": 0, \ "listName \": \ "par défaut \", \ "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 \ ", \" nom \ ": \" Parelhoen prijs/kg \ ", \" image \ ": \" \ ", \" type \ ": \" produit \ ", \" isPromo \ " : 0, \ "inList \": 14, \ "imageRotation \": \ "\", \ "expiration \": \ "01/01/10 \", \ "marque \": \ "\", \ "enseigne \": \ "\", \ "branche \": \ "\", \ "identificateur de branchement \": \ "00000000-0000-0000-0000-000000000000 \"}, {\ "amount \": 1 , \ "barré \": 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 \ ", \" nom \ ": \" 6 WASHANDJES + KAART M.BLAUW \ ", \" image \ ": \" \ ", \" type \ ": \" produit \ ", \" isPromo \ ": 0, \" inList \ ": 1, \" rotatorImage \ ": \" \ ", \" expiration \ ": \" 01/01/10 \ ", \" marque \ ": \" \ ", \" enseigne \ ": \" \ ", \" branche \ ": \" \ ", \" branchID \ ": \" 00000000-0000-0000-0000-000000000000 \ "}, {\" montant \ ": 7, \" barré \ ": 0, \" nom_liste \ ": \" 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 \ ", \" nom \ ": \" Hydraterend scheerapparaat HS8420 \ ", \" image \ ": \" \ ", \" type \ ": \" produit \ ", \" isPromo \ ": 0, \" inList \ ": 7, \" rotatorImage \ ": \" \ ", \" expiration \ ": \" 01/01/10 \ ", \" marque \ ": \" \ ", \" enseigne \ ": \ "\", \ "branche \": \ "\", \ "branchID \": \ "00000000-0 000-0000-0000-000000000000 \ "}, {\" montant \ ": 1, \" barré \ ": 0, \" nom_liste \ ": \" default \ ", \" listID \ ": \" 00000000- 0000-0000-0000-000000000000 \ ", \" TimeStamp \ ": \" 10/10/01 09:17:08 \ ", \" id \ ": \" fccf42c8-8c86-43b7-aca7-df05dd3cf85f \ " , \ "thumb \": \ "http: //mobile.boxolino.com/test/60aee80d-ad31-49b1-9895-4984fa348624_56x56.png \", \ "nom \": \ "Varkensgebraad prijs/kg \", \ "image \": \ "\", \ "type \": \ "produit \", \ "isPromo \": 0, \ "inList \": 1, \ "image_rotation \": \ "\", \ "expiration \": \ "01/01/10 \", \ "marque \": \ "\", \ "enseigne \": \ "\", \ "branche \": \ "\", \ "branchID \": \ "00000000-0000-0000-0000-000000000000 \"}, {\ "amount \": 4, \ "barré \": 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 \ ", \" nom \ ": \ "Rok rencontré print mt 36-46 \", \ "image \": \ "\", \ "type \": \ "produit \", \ "isPromo \": 1, \ "inList \": 4 , "rotatorImage \": \ "\", \ "expiration \": \ "0 01/01/10 \ ", \" marque \ ": \" \ ", \" enseigne \ ": \" \ ", \" branche \ ": \" Rokken \ ", \" identificateur de branchement \ ": \" f49ac233-5d53-4340-8b89-cae9a285c032 \ "}]}"}
La sortie normale doit être sans que "d" et tous les antislashs ...
Toute idée de ce qui se passe?
Comment je suis arrivé cette sortie:
NSString *responseString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
NSLog(@"ResponseString from Server: %@",responseString);
Merci à l'avance,
Lewion
Le problème n'est pas du côté du serveur, la sortie du serveur est sans l'objet "d". Les antislashs sont probablement normaux parce que je l'ai imprimé comme une chaîne et sinon vous ne pouvez pas mettre de guillemets doubles dans une chaîne ... juste que "d" me bug: S – Lewion
En regardant votre code, il n'y a pas de transformation effectuée les données, de sorte que le «d» est soit ajouté du côté du serveur ou il y a du travail fait sur les données avant le segment de code que vous avez posté. –
NSString * responseString = [[NSString alloc] initWithData: encodage responseData: NSUTF8StringEncoding]; \t NSLog (@ "ResponseString à partir du serveur:% @", responseString); Les données proviennent directement de la réponse ... responseData est ajouté avec les données de la réponse et à la fin je l'ai mis dans un NSString et je l'ai montré .. – Lewion