Provided the JSON below, how would I construct a JAMESPATH script to return the number of times the value in the "Code" key begins with "BS"
In this example my expected return would be: "2"
Thanks in advance!
{
"Data": {
"Matches": {
"ReasonCodes": [
{
"Reason": {
"Code": "BS02931298"
}
},
{
"Reason": {
"Code": "BS02931298:"
}
},
{
"Reason": {
"Code": "AS02931298"
}
}
]
}
}
}
I just kept digging and I finally came up with the answer:
length(Data.Matches.ReasonCodes[?Reason.starts_with(Code, 'BS')])