我在反序列化 JSON 值时遇到问题。
这是我的代码:
NSDictionary *responseDict = [NSJSONSerialization JSONObjectWithData: data options:0 error: &errorJson];
NSString *innerJson = responseDict[@"d"];
NSMutableDictionary *innerObject = [innerJson JSONValue];
正如您在下面的打印屏幕中看到的(这是在执行上面代码的最后一行之后立即拍摄的),字典 innerObject 中的项目包含特殊字符,这些字符在 innerJson 中不存在。有人可以帮助我,为什么会发生这种情况?
编辑 - 添加了来自控制台的变量描述
内部JSON:
{"ret" : "1", "msg" : "", "list" : ["Granatapfel¤200g¤1", "Brombeeren¤300g¤1", "Papaya (100 g)¤3¤0", "EPF Müesli 1 Messlöffel¤2¤1", "grüner Spargel (190 g)¤2¤1", "Chicorée (130 g)¤1¤0", "mageres Kalbfleisch (190 g)¤3¤0", "Zander (160 g)¤6¤0", "Bachsaibling (190 g)¤2¤0", "Seeteufel (160 g)¤1¤0", "EPF Guetzli Hafer/\nKartoffel-Dinkel 3 Stk.¤0¤0"]}
内部对象:
{
list = (
"Granatapfel\U00a4200g\U00a41",
"Brombeeren\U00a4300g\U00a41",
"Papaya (100 g)\U00a43\U00a40",
"EPF M\U00fcesli 1 Messl\U00f6ffel\U00a42\U00a41",
"gr\U00fcner Spargel (190 g)\U00a42\U00a41",
"Chicor\U00e9e (130 g)\U00a41\U00a40",
"mageres Kalbfleisch (190 g)\U00a43\U00a40",
"Zander (160 g)\U00a46\U00a40",
"Bachsaibling (190 g)\U00a42\U00a40",
"Seeteufel (160 g)\U00a41\U00a40",
"EPF Guetzli Hafer/\nKartoffel-Dinkel 3 Stk.\U00a40\U00a40"
);
msg = "";
ret = 1;
}