Efficiently extract nested data
Streamlining Data Retrieval with Jinja Filters vs. List Comprehension
Example scenario
JSON structure:
{
"events": [
{"details": {"name": "Event One", "location": "City A"}},
{"details": {"name": "Event Two", "location": "City B"}}
]
}Method one: Use list comprehension
{{ [item.details.name for item in CTX.events] }}Method two: Use jsonpath_query
jsonpath_queryMethod three: Use map with an attribute
map with an attributeComparison and effectiveness
Expected output
Last updated
Was this helpful?

