CMS Development

ariel_cu4tro
メンバー | Platinum Partner
メンバー | 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 いいね!
3件の返信
sharonlicari
コミュニティーマネージャー
コミュニティーマネージャー

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


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




0 いいね!
ariel_cu4tro
メンバー | Platinum Partner
メンバー | 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 いいね!
Kevin-C
名誉エキスパート | Solutions Partner
名誉エキスパート | Solutions 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?

Kevin Cornett - Sr. Solutions Architect @ BridgeRev