gpt4 book ai didi

json - 从 Json 中删除行

转载 作者:行者123 更新时间:2023-11-28 12:52:10 26 4
gpt4 key购买 nike

我正在尝试使用名为 MTG Json 的网站作为数据库的一部分,将 iOS 应用程序制作为项目。

他们为游戏中打印的所有卡片提供了一个开源数据库。这就是他们格式化它的方式。

 {"Air Elemental":{"layout":"normal","name":"Air Elemental","manaCost":"{3}{U}{U}","cmc":5,"colors":["Blue"],"type":"Creature — Elemental","types":["Creature"],"subtypes":["Elemental"],"text":"Flying","power":"4","toughness":"4","imageName":"air elemental","colorIdentity":["U"]},

"Ancestral Recall":{"layout":"normal","name":"Ancestral Recall","manaCost":"{U}","cmc":1,"colors":["Blue"],"type":"Instant","types":["Instant"],"text":"Target player draws three cards.","mciNumber":"1","imageName":"ancestral recall","colorIdentity":["U"]},

我想做的是编写一个代码来删除这些行的第一部分

移除“Ancestral Recall”:或“Air Elemental”:以便于使用。

有什么简单的方法可以做到这一点吗?还是我缺少更好的解决方案?

提前致谢

最佳答案

我认为您不需要删除这些行,因为它们是以 JSON 格式提供的对象的关键,而不是仅仅按原样解析 JSON 并获取对象,这里更具体地说 NSDictionary 并通过检索字典的所有键,您可以从中获取所有对象

关于json - 从 Json 中删除行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36146232/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com