How can you subset a SwiftyJSON JSON object

♀尐吖头ヾ 提交于 2019-12-02 11:21:25

You can grab the associated dictionaryValue from your SwiftyJSON object and use the removeValueForKey method.

Of course it means you have to assign the dictionaryValue to a variable, you can't remove a key in the SwiftyJSON object itself.

Example:

var dataDict = json["data"].dictionaryValue
dataDict.removeValueForKey("runs")

Note: the removeValueForKey method name is a bit misleading; it will remove the key, not just the value.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!