Adobe Target Design : Escape " | Adobe Higher Education
Skip to main content
Level 2
April 20, 2022
Resuelto

Adobe Target Design : Escape "

  • April 20, 2022
  • 1 respuesta
  • 617 visualizaciones

<li data-cmp-data-layer="{"$entity.id" :{image:$entity.thumbnailUrl,@type:$resourceType,title:$entity.name,descriptions:$entity.message}}" data-cmp-clickable class="card" ></li>

 

Result in html in browser:

<li data-cmp-data-layer="{" card-items-3fbe5ed156"="" :{image:https:="" www.visitsaudi.com="" content="" dam="" car-rentals="" enterprise-rent-a-car-logo-1280x720-2.png,@type:sauditourism="" components="" c27-teaser-with-cards="" v1,title:enterprise,descriptions:get="" 30%="" off.="" click="" the="" link="" below}}"="" data-cmp-clickable="" class="card is-active"></li>

 

As you can see, it add extra space between first second quotes and javascript ignores that attribute value is just "{".

How can i escape it properly.

 

Uncaught SyntaxError: Unexpected end of JSON input
at JSON.parse (<anonymous>)
at getComponentData (core.wcm.components.commons.datalayer.v1.js:158:25)
at getComponentObject (core.wcm.components.commons.datalayer.v1.js:130:25)
at addComponentToDataLayer (core.wcm.components.commons.datalayer.v1.js:121:24)
at core.wcm.components.commons.datalayer.v1.js:184:17
at NodeList.forEach (<anonymous>)
at HTMLDocument.onDocumentReady (core.wcm.components.commons.datalayer.v1.js:183:24) 

 

 

Thanks for support!

Este tema ha sido cerrado para respuestas.
Mejor respuesta de qazwsx2

found the solution just after posting the question. I used 

&quot; instead of other solution.

 

1 respuesta

qazwsx2AutorRespuesta
Level 2
April 20, 2022

found the solution just after posting the question. I used 

&quot; instead of other solution.