How to get the first element when filter in jsonpath?
问题 So I'm working on the below json: { "id": "", "owner": "some dude", "metaData": { "request": { "ref": null, "contacts":[ { "email": null, "name": null, "contactType": "R" }, { "email": null, "name": "Dante", "contactType": "S" } ] } } } I want to retrieve the name of contact has type S and only the first one that returned. Using jsonpath with this path "$..contacts[?(@.contactType == 'S')].name" always return an array of string because a filter operation always return result as an array. So I