- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
Enhanced Security Measures in Place: To ensure a safer experience, we’ve implemented additional, temporary security measures for all users.
04-13-2023 04:08 AM
Hi!
I want to be able to manipulate context keys by selecting the keys I want, and moving them to upper level. E.g.: Assuming I have the following in the context:
I want to have a new context key with only Name and HairColor:
GetFields transformer seems to have similar functionality, however I cannot tell it to get subkeys, e.g. Appearance.Head.HairColor.
Any ideas?
Thanks,
Antanas
04-13-2023 08:08 PM
A jmespath transformer can do this.
You can test your jmespath expression in the war room like this:
Then use it as a transformer:
And finally check the results in the context:
Also... John should maybe get his red eyes looked at, I'm not a doctor but that doesn't seem normal 🤣
04-13-2023 08:15 AM
I believe you need to add more context to what you intend by "selecting the keys I want and moving them to the upper level". Why not just created a new context Upper-Level key? You can try running !Print with this value => ${ParentKey.[].appearance.head}, it should grab all the values you want. Then use !Set or !Setmultiplevalues depending on what works for you.
Let me know what works for you.
04-13-2023 08:08 PM
A jmespath transformer can do this.
You can test your jmespath expression in the war room like this:
Then use it as a transformer:
And finally check the results in the context:
Also... John should maybe get his red eyes looked at, I'm not a doctor but that doesn't seem normal 🤣
04-15-2023 11:46 PM
Hi @chrking , this worked like a charm! Thanks a lot.
This was just a mock data, not to worry about someones red eyes, all are safe and healthy 🙂
04-15-2023 11:50 PM
Hi @michaelsysec242 ,
I think the problem with your suggested approach is that i can't output multiple keys in a singe query, therefore i wouldn't be able to properly set them into one key.
Anyways, the other suggestion was to use jmespath as a transformer, and that worked quite well.
Thanks!
Click Accept as Solution to acknowledge that the answer to your question has been provided.
The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!
These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!
The LIVEcommunity thanks you for your participation!