<@ULVA73B9P> is the from_json jinja template filte...
# ask-marvin
z
@Marvin is the from_json jinja template filter available for automations in prefect3
m
thought for 194.0 seconds
Short answer: no — there isn’t a
from_json
Jinja filter available in Prefect 3 automations. Details: - Prefect 3’s automation templates use Jinja2 with standard Jinja filters plus two Prefect-specific filters:
ui_url
and
ui_resource_events_url
. There’s no built‑in JSON parsing filter like
from_json
. - Prefect filters: prefect.server.events.jinja_filters - Template environment: prefect.server.utilities.user_templates - If your event originated from a Prefect Webhook with
Content-Type: application/json
, the body is already parsed to a Python dict in the template context. You can access it directly without parsing:
Copy code
Order ID: {{ event.payload.body.order_id }}
Docs: - Automations templates: Access parameters in templates - Webhooks behavior: Webhooks concept Alternatives if you truly have a JSON string in a field: - Prefer to send structured data so it arrives parsed (e.g., ensure the source sends JSON and correct content-type or pre-process via a Prefect Webhook template). - Kick off a flow from the automation and parse the string in Python (e.g.,
json.loads
) inside the flow rather than in the Jinja template. If you share a small sample of your event payload and the template snippet you’re working with, I can suggest the best way to access the fields directly.