Substitutions in API injection

I realize that I could just test it, but I thought that I would ask to shortcut either my pain or someone else’s that comes after me. The question on subsitutions is.

Do substitutions support hierarchical structure. Meaning do I need to flatten my JSON.

So will the follow structure work:

substitution: {
contact: {
occupation: “Birdcatcher”
}
}

And then the template look like this:

content: “My job is {{ contact.occupation }}”

So the answer is:

{{ contact.first_name }} → “Larry” and {{animal}} → “dog” both merged just fine.

That behavior was my expectation, but wanted assurance before rewriting previous paths of code.

Now anyone else with this question who finds this will have an answer.

Just a note for lurkers on the thread, you have to pass a value in for the value int he template, for example, if I have {{contact.first_name}} in my template, but do not but that in the substitutions array, it will throw an error.

default in minijinja::filters - Rust is probably what you want in that case