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

**URL:** <https://forum.mautic.org/t/output-of-json-key-from-json-object-in-contact-in-email/27217>\
**Category:** Product Support\
**Created:** [March 1, 2023, 4:26pm UTC](https://forum.mautic.org/t/output-of-json-key-from-json-object-in-contact-in-email/27217 "2023-03-01T16:26:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![iparker](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/iparker/32/1936_2.png) [@iparker](https://forum.mautic.org/u/iparker)\
**Post date:** [March 1, 2023, 4:26pm UTC](https://forum.mautic.org/t/output-of-json-key-from-json-object-in-contact-in-email/27217/1 "2023-03-01T16:26:24Z")

</div>

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:

```auto
{
      "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

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [March 3, 2023, 9:26am UTC](https://forum.mautic.org/t/output-of-json-key-from-json-object-in-contact-in-email/27217/2 "2023-03-03T09:26:25Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![iparker](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/iparker/32/1936_2.png) [@iparker](https://forum.mautic.org/u/iparker)\
**Post date:** [March 3, 2023, 10:10am UTC](https://forum.mautic.org/t/output-of-json-key-from-json-object-in-contact-in-email/27217/3 "2023-03-03T10:10:04Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [March 3, 2023, 10:13am UTC](https://forum.mautic.org/t/output-of-json-key-from-json-object-in-contact-in-email/27217/4 "2023-03-03T10:13:31Z")

</div>

I understand - sorry Twig template is the best option.

---

<div class="post-metadata">

**Author:** ![asad786](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/asad786/32/8990_2.png) [@asad786](https://forum.mautic.org/u/asad786)\
**Post date:** [March 14, 2023, 1:04pm UTC](https://forum.mautic.org/t/output-of-json-key-from-json-object-in-contact-in-email/27217/5 "2023-03-14T13:04:33Z")

</div>

You can use this in twig template:

{% for user in users %}

{{ user.lastname}}

{% endfor %}

".
