jslt
jslt copied to clipboard
Struggling with Queries
Given some input JSON like:
{"foo" : [
{"name": "Smith", "age": 22},
{"name": "Jones", "age": 30},
{"name": "Doe", "age": 35}
]}
what is the JSLT expression that one would use to extract age "where name==Jones"?
That's it.
let ageJones = array([for(.foo).age if(.name=="Jones")])[0]
{ "AgeJones" : $ageJones }