Integrating JSON with Email Template

I am currently working with an email template. I am trying to integrate my json script into it. I have gotten it to work before but for some reason, it is no longer working. I am certain that I am writing the code correctly:

SCRIPT:

------- Selector being #email -------

var translations = loadjson(‘Snippets/B.json’);

results.each(function() {

__if__ (__this__.attr(‘asm_group_unsubscribe_url’) __in__ translations) {

   __this__.html(translations[__this__.attr(‘asm_group_unsubscribe_url’)]);

}

});

JSON SNIPPET:

{

  "asm_group_unsubscribe_url": "<%asm_group_unsubscribe_url%>"

}

HTML:

<span id=“email” class=“localized”>email</span>

Where am I going wrong? The result just shows “email”.

I don’t understand the line:

__if__ (__this__.attr(‘asm_group_unsubscribe_url’) __in__ translations) {

You’re basically looking for an attribute named asm_group_unsubscribe_url in the current HTML element. But your HTML sample does not include such an attribute. So you’d have to add it.

Or maybe what you wanted to do was to see if the asm_group_unsubscribe_url exists in the snippet, in which case you’d use

__if__ (translations__.__asm_group_unsubscribe_url) {

That does not work either. It shows “undefined”.

I was following the documentation at:

I was able to get it to work before using this code but it is not working recently. Not sure if there was an update.

I got it - thanks - it was much simpler…

var json_data = loadjson(“snippets/B.json”);
results.html(json_data.asm_group_unsubscribe_url);