【发布时间】:2012-06-12 06:19:50
【问题描述】:
我有这种格式的json字符串:
[{"image":"/0001.jpg","link":"/index.php"},
{"image":"/0001.jpg","link":"/index.php"}]
它在顶层没有键。
[mapping mapKeyPath:@"image" toAttribute:@"image"];
这样的映射不起作用,它给了我错误:
restkit.object_mapping:RKObjectMapper.m:81 Adding mapping error: Could not find an object mapping for keyPath: ''
如何映射这种类型的json?
【问题讨论】:
-
那是 JSON 字典的正确格式吗,我认为在顶层添加键是正式的。我猜这不是你要编辑的 json,很有趣。
-
我还没有找到办法。幸运的是,我还控制了我的服务器并修改了服务器以添加顶级密钥。