我有一些从api返回的数据,我已经解析为:
[{:a=>value1, :b=>value2, :c=>value3, :d=>value4}, {:a=>value5, :b=>value6, :c=>value7, :d=>value8},{:a=>value9, :b=>value10, :c=>value11, :d=>value12}, ...]
Run Code Online (Sandbox Code Playgroud)
我怎样才能创建一个散列的新数组键和值的b和c给予,key = b和key = c?我想传递密钥并返回值并保持密钥.所以我想最终得到:
[{:b=>value2, :c=>value3}, {:b=>value6, :c=>value7}, {:b=>value10, :c=>value11}, ...]
Run Code Online (Sandbox Code Playgroud)