John R Perry John R Perry - 2 months ago 13
JSON Question

Can text be encoded with URIComponent instead of escaped?

Examples:

Text that is escaped (in articleBody):

<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "NewsArticle",
"headline": "Article headline",
"alternativeHeadline": "The headline of the Article",
"image": ["thumbnail1.jpg", "thumbnail2.jpg"],
"datePublished": "2015-02-05T08:00:00+08:00",
"description": "A most wonderful article",
"articleBody": "\"Hello!\" said Bob.\n\"Hi,\" said Jane, \"Go away.\""
}
</script>


And the same text encoded with URIComponent (again, in articleBody):

<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "NewsArticle",
"headline": "Article headline",
"alternativeHeadline": "The headline of the Article",
"image": ["thumbnail1.jpg", "thumbnail2.jpg"],
"datePublished": "2015-02-05T08:00:00+08:00",
"description": "A most wonderful article",
"articleBody": "%22Hello!%22%20said%20Bob.%0A%22Hi%2C%22%20said%20Jane%2C%20%22Go%20away.%22%0A"
}
</script>

Answer

No, you cannot. Google will not parse the encoded text which will result in encoded characters appearing in the rich snippet/rich card.

Here's a very basic example — copy the code below and paste it into Google's schema checker:

<script type="application/ld+json">
{
  "@context": "http://schema.org/",
  "@type": "Recipe",
  "name": "Perfect%20Apple%20Pie",
  "image": "http://images.edge-generalmills.com/56459281-6fe6-4d9d-984f-385c9488d824.jpg"
}
</script>

Click 'Validate' and you'll see a green 'Preview' button. When you click preview, this is what you'll see:

enter image description here

Comments