RestKit:如何获取一个简单的 JSON 字符串数组? [英] RestKit: how to fetch a simple JSON array of strings?
问题描述
我应该如何使用 RestKit 来获取这样的 JSON 字符串数组:
How should I use RestKit to fetch a JSON array of strings like this :
["Paris", "London", "Brussels", "New York"]
我尝试进行对象映射,但由于没有关键路径或属性,我不知道要映射什么.
I tried to make an object mapping but since there's no key path or attribute, I don't know what to map.
我什至不需要映射,结果可能只是一个数组或字典.有没有办法做到这一点?
I don't even need a mapping, the result could just be an array or a dictionary. Is there a way to achieve that?
欲了解更多信息 &解决方案:https://github.com/RestKit/RestKit/issues/1290>
For more info & solution : https://github.com/RestKit/RestKit/issues/1290
推荐答案
您需要使用 nil
键路径创建映射.这指示 RestKit 直接将字符串值映射到目标对象中.请参阅此参考.
You need to create a mapping with a nil
keypath. This instructs RestKit to directly map the string values into your destination objects. See this reference.
这篇关于RestKit:如何获取一个简单的 JSON 字符串数组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!