I am trying to filter the below JSON object and return an array of objects where the value within the key of 'markdown' contains say "steve" - to do this I suspect I need to convert the object to an array then filter.
I have tried using Object.entries
Object.entries(diagnosisData).filter(item => item === 'steve')
as well as JSON.parse but think I am barking up the wrong tree.
I'd like to return say:
result = [
{
"id": "stevey",
"markdown": "STEVEY",
"source": null
},
{
"id": "steven",
"markdown": "STEVEN",
"source": null
}
]
Could anyone offer a pointer for me?
Many thanks
JSONdata = {
"steven": {
"id": "steven",
"markdown": "STEVEN",
"source": null
},
"john": {
"id": "johnA",
"markdown": "JOHNA",
"source": null
},
"henry": {
"id": "henryP",
"markdown": "HENRYP",
"source": null
},
"stevel": {
"id": "steveL",
"markdown": "STEVEL",
"source": null
}
}