仅 iPhone(和 iPhone 模拟器)上的奇怪响应 JSON
我通过 JSON 向我的服务器发送一个列表,服务器会更新该列表并将更新后的列表发回给我。但是当我收到响应时,我收到一些奇怪的 JSON:
来自服务器的响应字符串:{"d":"{\"basketList\":[{\"amount\":1,\"strikethrough\":0,\"listName\":\"default\", \"listID\":\"00000000-0000-0000-0000-000000000000\",\"时间戳\":\"10/10/01 09:17:08\",\"id\":\"4116858a -374b-489b-ae26-5175b7b7b0f9\",\"拇指\":\"http://mobile.boxolino.com/test/60aee80d-ad31-49b1-9895-4984fa348624_56x56.png\",\"名称\" :\"0,5L ROOMIJS 巧克力\",\"图片\":\"\",\"类型\":\"产品\",\"isPromo\":0,\"inList\":1, \"rotatorImage\":\"\",\"过期\":\"01/01/10\",\"品牌\":\"\",\"enseigne\":\"\",\ "分支\":\"\",\"分支ID\":\"00000000-0000-0000-0000-000000000000\"},{\"金额\":1,\"删除线\":0,\" listName\":\"default\",\"listID\":\"00000000-0000-0000-0000-000000000000\",\"时间戳\":\"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\",\"名称\":\"Biokatoenen washandjes 4 Stuks - 16 x 21 cm\",\"图片\":\"\",\"类型\":\"产品\",\" isPromo\":0、\"inList\":1、\"rotatorImage\":\"\"、\"过期\":\"01/01/10\"、\"品牌\":\"\ ",\"enseigne\":\"\",\"branch\":\"\",\"branchID\":\"00000000-0000-0000-0000-000000000000\"},{\"金额\ ":14,\"删除线\":0,\"列表名称\":\"默认\",\"列表ID\":\"00000000-0000-0000-0000-000000000000\",\"时间戳\": \"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\",\"名称\":\"Parelhoen prijs/kg\",\"图像\":\"\",\"类型\" :\"产品\",\"isPromo\":0,\"inList\":14,\"rotatorImage\":\"\",\"过期\":\"01/01/10\", \"品牌\":\"\",\"enseigne\":\"\",\"分公司\":\"\",\"分公司ID\":\"00000000-0000-0000-0000-000000000000 \"},{\"金额\":1,\"删除线\":1,\"listName\":\"默认\",\"listID\":\"00000000-0000-0000-0000-000000000000 \",\"时间戳\":\"10/10/01 09:17:08\",\"id\":\"7798392f-d47d-48b1-a368-c3d65dcb1523\",\"拇指\": \“http://mobile.boxolino.com/test/60aee80d-ad31-49b1-9895-4984fa348624_56x56.png\”,\“名称\”:\“6 WASHANDJES + KAART M.BLAUW \”,\“图像\ ":\"\",\"类型\":\"产品\",\"isPromo\":0,\"inList\":1,\"rotatorImage\":\"\",\"过期\ ":\"01/01/10\",\"品牌\":\"\",\"enseigne\":\"\",\"分支机构\":\"\",\"branchID\" :\"00000000-0000-0000-0000-000000000000\"},{\"金额\":7,\"删除线\":0,\"listName\":\"default\",\"listID\" :\"00000000-0000-0000-0000-000000000000\",\"时间戳\":\"10/10/01 09:17:08\",\"id\":\"2e3040a1-2c6e-469c- 8f09-d4bc58eda5df\",\"拇指\":\"http://mobile.boxolino.com/test/60aee80d-ad31-49b1-9895-4984fa348624_56x56.png\",\"名称\":\"Hydraterend scheerapparaat HS8420\"、\"图像\":\"\"、\"类型\":\"产品\"、\"isPromo\":0、\"inList\":7、\"rotatorImage\":\ "\"、\"有效期\":\"01/01/10\"、\"品牌\":\"\"、\"enseigne\":\"\"、\"分支机构\":\" \",\"branchID\":\"00000000-0000-0000-0000-000000000000\"},{\"金额\":1,\"删除线\":0,\"listName\":\"默认\",\"listID\":\"00000000-0000-0000-0000-000000000000\",\"时间戳\":\"10/10/01 09:17:08\",\"id\": \“fccf42c8-8c86-43b7-aca7-df05dd3cf85f\”,\“拇指\”:\“http://mobile.boxolino.com/test/60aee80d-ad31-49b1-9895-4984fa348624_56x56.png\”,\“名称\":\"Varkensgebraad prijs/kg \",\"图像\":\"\",\"类型\":\"产品\",\"isPromo\":0,\"inList\": 1、\"rotatorImage\":\"\"、\"过期\":\"01/01/10\"、\"品牌\":\"\"、\"enseigne\":\"\" ,\"分支\":\"\",\"分支ID\":\"00000000-0000-0000-0000-000000000000\"},{\"金额\":4,\"删除线\":0, \“列表名称\”:\“默认\”,\“列表ID \”:\“00000000-0000-0000-0000-000000000000 \”,\“时间戳\”:\“10/10/01 09:17:08 \",\"id\":\"cfcdd1e9-cd52-4884-9cf0-e54f98f33c2f\",\"拇指\":\"http://mobile.boxolino.com/test/60aee80d-ad31-49b1-9895 -4984fa348624_56x56.png\",\"名称\":\"Rok met print mt 36-46\",\"图像\":\"\",\"类型\":\"产品\",\" isPromo\":1、\"inList\":4、\"rotatorImage\":\"\"、\"过期\":\"01/01/10\"、\"品牌\":\"\ ",\"enseigne\":\"\",\"branch\":\"Rokken\",\"branchID\":\"f49ac233-5d53-4340-8b89-cae9a285c032\"}]}"}< /p>
正常输出应该没有那个“d”和所有的反斜杠......
知道发生了什么吗?
我如何得到这个输出:
NSString *responseString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
NSLog(@"ResponseString from Server: %@",responseString);
提前致谢,
Lewion
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 WASHANDJES +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\":\"http://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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
可能与服务器中的子模块有关,而不是iPhone中的子模块。
有很多方法可以解决它。例如:
1. 将\"替换为",获取JSON对象后获取键“d”的值作为最终对象,
2. 尝试查看服务器中的子模块,然后尝试将其配置为具有不同的配置或将其替换为更好的配置。
如果您需要有关第二个选项的帮助,您将需要发布更多与服务器相关的数据。
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.