Output of json-key from json-object in contact in email?

Hello,

is there a way to out data/values from a json object inside an email (using the legacy email editor)?

For example: If I have an json object in a contact-field like this:

{
      "firstName" : "Max",
      "lastName" :  "Muster",
      "age" : 25
}

Is there a way to output the lastname or age of this object?

The only idea I have is to use the twig template extension for this. But with this I have to create a twig template for each object-value I want to output - not very handy.

This would be good to store different values (which are not required for search/segments) in a single json-field in mautic.

Thanks for some help!

Best regards,

Timo

Hello Timo!
For me twig templates seem the best solution too. you can display them one twig template each, or combined.
What would be the html outcome you are looking for?

Hi Joey,

thanks for your reply.

I think the html outcome is just the simple text string of the value.

So for my example-object just “Muster” for the lastname.

What do you mean with “combined in one twig template”? This just works if I output always the same values of the object, for example a twig-template for the full name.
I think there is no way to have something like a twig template with parameters to display different values with one twig template.

I understand - sorry Twig template is the best option.

You can use this in twig template:

{% for user in users %}

{{ user.lastname}}

{% endfor %}

".