Expand my Community achievements bar.

Take 10 minutes to complete an Adobe Target review on Gartner Peer Insights, and as a thank you for your time, you’ll have the option to receive a $25 gift card!
SOLVED

Adobe Target Design : Escape "

Avatar

Level 2

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

1 Accepted Solution

Avatar

Correct answer by
Level 2

found the solution just after posting the question. I used 

&quot; instead of other solution.

 

View solution in original post

1 Reply

Avatar

Correct answer by
Level 2

found the solution just after posting the question. I used 

&quot; instead of other solution.