Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Adobe Target Design : Escape "

Avatar

Level 1

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

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 1

found the solution just after posting the question. I used 

&quot; instead of other solution.