CMS Development

ariel_cu4tro
Member | Platinum Partner
Member | Platinum Partner

JSON property

I need put a JSON in a property of a contact and after, read this property with jquery in a module to email. Is this posible?

0 Upvotes
3 Replies 3
sharonlicari
Community Manager
Community Manager

JSON property

Hi @ariel_cu4tro    

 

could you please share more context or the code you are using?. This will help the experts I will tag so they will be able to advise you.      

 

Hey @DanielSanchez @Jsum @Stephanie-OG  could you please share your knowledge with @ariel_cu4tro?

 

Thank you & Happy Friday

Sharon


¿Sabías que la Comunidad está disponible en Español?
¡Participa hoy en conversaciones en el idioma de tu preferencia,cambiando el idioma en tus configuraciones!

Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings !


0 Upvotes
ariel_cu4tro
Member | Platinum Partner
Member | Platinum Partner

JSON property

of course, 

i need to read a json like to:

{
"vacante": [{
"Nombre": "jesus",
"URL": "url1"
},
{
"Nombre": "ariel",
"URL": "url2"
},
{
"Nombre": "jose",
"URL": "url3"
}
]
}

 

This json somebody send me by API Hubspot and i cant read with jQuery this property, next code is a module to EMAIL:

<p class="propiedad">
{ "Vacantes": [{ "Nombre": "jesus ", "URL": "url1" }, { "Nombre": "ariel ", "URL": "url2" }, { "Nombre": "jose", "URL": "url3" }] }
</p>
<div class="vacantes">

</div>
<script
src="https://code.jquery.com/jquery-3.4.1.min.js"
integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo="
crossorigin="anonymous"></script>
<script>
$(function()
{
// { "Vacantes": [{ "Nombre": "jesus ", "URL": "url1" }, { "Nombre": "ariel ", "URL": "url2" }, { "Nombre": "jose", "URL": "url3" }] }
var obj = jQuery.parseJSON( $(".propiedad").text() );

for(i=0;i < obj.Vacantes.length;i++)
{
$(".vacantes").append("<p>Vacantes "+i+": "+obj.Vacantes[i].Nombre+"</p><a href="+obj.Vacantes[i].URL+"> URL</a>")
}
});
</script>

 

0 Upvotes
Kevin-C
Recognized Expert | Partner
Recognized Expert | Partner

JSON property

Hey everyone,

 

Correct me if I'm wrong, but i'm pretty sure JS isn't usable in email modules.

 

Might this be done using HubLs fromjson filter?