From 127c7707ac0705efa31a563a6596d0802dcffa3b Mon Sep 17 00:00:00 2001 From: Danny Tsang <567982+dannytsang@users.noreply.github.com> Date: Fri, 18 Feb 2022 22:54:30 +0000 Subject: [PATCH] Fix rendering of `is_defined` example. (#21575) --- source/_docs/configuration/templating.markdown | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/_docs/configuration/templating.markdown b/source/_docs/configuration/templating.markdown index 66dfe920f50..f7b5f158180 100644 --- a/source/_docs/configuration/templating.markdown +++ b/source/_docs/configuration/templating.markdown @@ -515,10 +515,14 @@ The `is_defined` filter allows to throw an error if a value or object is not def Example using `is_defined` to parse a JSON payload: +{% raw %} + ```text {{ value_json.val | is_defined }} ``` +{% endraw %} + This will throw an error `UndefinedError: 'value_json' is undefined` if the JSON payload has no `val` attribute.