I receive a JSON from a REST service which is represented by the following JavaScript object:
[
{
name: 'demo1',
contentType: 'text/plain',
lang: 'en-US',
type: 'FILE',
revision: 5
},
{
name: 'demo2',
contentType: 'text/plain',
lang: 'en-US',
type: 'FILE',
revision: 29
}
]
From this object I'd like to extract all values from the name
key, i.e. in the end I have a new array with the values [demo1, demo2]
.
I tried running a for-loop over Object.entries()
but this seems somewaht tedious. There is probably a much easier way.