Adobe Target Design : Escape " | Community
Skip to main content
Level 2
April 20, 2022
Solved

Adobe Target Design : Escape "

  • April 20, 2022
  • 1 reply
  • 617 views

<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!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by qazwsx2

found the solution just after posting the question. I used 

&quot; instead of other solution.

 

1 reply

qazwsx2AuthorAccepted solution
Level 2
April 20, 2022

found the solution just after posting the question. I used 

&quot; instead of other solution.