Walks the JSON queries of a JSON-Path string, in order, and returns the properties of the first one matching the given find function.
find
The JSON-Path string to search.
A function to test each set of extracted properties.
The properties of the first JSON query that matches the find function, or an empty object if none match.
const path = `$.values[?(@.key == 'y')].value.contentData[?(@.alias == 'x')]`;const props = extractFirstJsonQueryContaining(path, (props) => props.alias !== undefined);console.log(props); // { alias: 'x' } Copy
const path = `$.values[?(@.key == 'y')].value.contentData[?(@.alias == 'x')]`;const props = extractFirstJsonQueryContaining(path, (props) => props.alias !== undefined);console.log(props); // { alias: 'x' }
Walks the JSON queries of a JSON-Path string, in order, and returns the properties of the first one matching the given
findfunction.