【发布时间】:2019-02-21 06:00:27
【问题描述】:
我只是 swift 的初学者。 我想过滤具有特定属性的 json 对象数组并从中创建新的 json 数组。
我的数组是:
[{
"marked" : 4,
"attempted" : true,
"correct" : 4,
"subject" : 1,
"status" : true,
"question" : 550,
"answer" : 34256,
"time" : 23,
"score" : 10,
"chapter" : 26
}, {
"marked" : 1,
"attempted" : true,
"correct" : 1,
"subject" : 1,
"status" : true,
"question" : 566,
"answer" : 34317,
"time" : 33,
"score" : 14,
"chapter" : 26
}, {
"marked" : 4,
"attempted" : true,
"correct" : 1,
"subject" : 1,
"status" : true,
"question" : 590,
"answer" : 34276,
"time" : 33,
"score" : 15,
"chapter" : 26
}]
我想要一个数组,其中 marked 和 correct 具有相同的值。
我怎样才能快速做到这一点?
【问题讨论】:
标签: arrays json swift swifty-json