I need to filter the objects that contain special characters in this json. (I can either write a javascript or import and query the data in mongo. )
{
"Detail": [{
"name": "somename1",
"text": "Sometext1"
},
{
"name": "somename2",
"text": "Sometext!"
}, {
"name": "somename3",
"text": "método"
}
]
}
Expected output
{
"Detail": [
{
"name": "somename2",
"text": "Sometext!"
},
{
"name": "somename3",
"text": "método"
}
]
}
Is there a way to use regular expression in jsonpath or jmspath to do this?
I tried various approached to get closer to what I need such as these, but I'm blocked at this point
Detail[].text.contains(`é`) in jmespath
$.[?(@.text=~ ^[a-zA-Z0-9]*$].text in jsonpath
db.test.find({'Detail.text': /[a-zA-Z0-9]*$]/}) in mongodb where 'test' is the collection