How to filter, flatten and rewrite REST-api results #126
-
A question I often hear, is when you get a detailed and deep-nested rest result, how can you cleanup, filter and flatten rest result. Every REST function (fn.fnRestBasic, fn.fnRestJwt, ...) has a JQ property that will run against the result. https://ansibleforms.com/expressions/#rest-api-with-basic-authentication Point your questions about jq and rest result filtering here. Or better, share your snippets. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
how do I get custom_fields.segment_name as columns (enum)
|
Beta Was this translation helpful? Give feedback.
-
From your sample, can you show me what the output should be ? |
Beta Was this translation helpful? Give feedback.
you need to rewrite the output with jq.
you already use [.records[]] => you must enhance this.
jqplay snippet
[.records[] | {id:.id,display:.display,segment:.custom_fields.segment_name}]
Try this snippet, you will see