I’ve noticed a limitation of jsonpath that seems to be biting me at the moment, and curious if anyone has run into this before and can share a solution.
I’m working on a custom Web Services connector, and noticed that all my attributes are coming back as single-item arrays rather than as strings (even though the schema attributes are not configured as multi-valued). While this displays fine in the UI (for the most part; the only place I can see that the values are arrays is the account name which is wrapped in square brackets [ ]
), it’s very clear when you pull the list of accounts down via the ISC API.
My research has indicated that this is actually a long-known jsonpath limitation - once you apply a filter, you’re stuck with an array, and can’t even use [0]
to address the first (and only) item in said array.
This can be reproduced with the default input in the SailPoint JSONPath Evaluator. A query that is analogous to what I’m trying to do is:
$.requestedItemsStatus[*].approvalInfo[?(@.approvalDecision=='APPROVED')].approverName
You can see that if you tack on a [0]
to the end of that, you get an empty array.
The structure of the responses I’m getting from the Web Service is as follows:
{
"parent": [
{
"attribute1": "12345",
"attribute2": "ABC DEF",
"attribute3": "1a2b3c4d5e6f",
"fields": [
{
"name": "ThisOne",
"value": "foo"
},
{
"name": "NotThisOne",
"value": "bar"
}
]
}
]
}
The expected result would be to have an attribute ThisOne
with a value of foo
, not a value of ["foo"]
. Ideally, I’d like to solve this without needing to implement a rule…
Thanks!
-Mark