Adrian_Santamaria | 2021-03-02 16:10:18 UTC | #1
Hello
I have a webservice that returns some elements whose property key can change over time, but which includes the references between temporary keys and permanent reference keys. For example, the WS may return this:
{ "refs":{ "permanent1": "temp1", "permanent2": "temp2", "permanent3": "temp3" }, "elements":{ "temp1": {thing I want to get 1}, "temp2": {thing I want to get 2}, "temp3": {thing I want to get 3} } }
And after a while, it may returns this:
{ "refs":{ "permanent1": "temp10", "permanent2": "temp20", "permanent3": "temp30" }, "elements":{ "temp10": {thing I want to get 1}, "temp20": {thing I want to get 2}, "temp30": {thing I want to get 3} } }
I have tried to reference the values using JSONPaths like $.elements[$.refs.permanent1], but it does not work.
Does anyone know if this is somehow possible?
Thank you
Jason_Mathison | 2021-03-02 15:56:04 UTC | #2
Hey Adrian,
AFAIK it is not possible to have JSONPath use the results of one search to fill into another like you are attempting. I would love to be proved wrong though, that would be a great feature to have.
One option is elements.*
That will return all of the elements for you in order. If you need more complex refs to elements mapping I would recommend using a lambda with a tiny bit of javascript to detangle it. You could escape the JSON you are getting from the existing data action and then pass it to a second lambda data action. Or if
--Jason
Adrian_Santamaria | 2021-03-02 16:09:57 UTC | #3
Ok, thank you Jason
system | 2021-04-02 16:09:59 UTC | #4
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 10143