I receive a json object with a promise call that has the following structure:
[{ key1:'value1', key2:'value2',...},{ key1:'value1', key2:'value2',...},...]
what I wanna do with this is to "filter" some keyx:'valuex'
pairs from every object (which could be done with a map function, I suppose).
The best I could accomplish was by doing:
x.response.map((r) => new Map([['number',r.number],['hash', r.hash]]))
But that gives me a [Map(2), Map(2)]
object
I want simply a [{...}, {...}]
object
Example:
Input:
[{id:1, name:'John', age:30}, {id:2, name:'Mary', age: 24}, {id:3, name:'Jack', age: 32}]
Output:
[{name:'John', age:30}, {name:'Mary', age: 24}, {name:'Jack', age: 32}]