1 year ago

#221077

test-img

Álvaro García

Google test gives me "Missing '}' or object member name" error and i cant find why

I cant find why this structure doesnt work properly. I tried thousands of different possibilities and always gives the same error: Missing '}' or object member name. error

It could be because of the unicode " elements? i did try many ways to fix it but i couldnt find the good one

Its created by a loop in php:

$item_elements = array();
$count = count($srcs);
for($i = 0;$i < $count; $i++){
    $pos = $i+1;
    $here = [
        '@type' => 'ListItem',
        'position' => $pos,
        'item' => array(
                'name' => $titles[$i],
                'description' => $desc[$i],
                'url' => $hrefs[$i],
                'image' => $srcs[$i]
            )];
    array_push($item_elements, $here);
}

$output = [
    '@context' => 'https://schema.org',
    '@type' => 'ItemList',
    "name" => 'example name',
    'itemListElement' => $item_elements
];
?>
<script type="application/ld+json">
  <?php echo json_encode($output, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT | JSON_HEX_QUOT | JSON_UNESCAPED_UNICODE); ?>
</script>

This is the looking in the website:

{
    "@context": "https://schema.org",
    "@type": "ItemList",
    "name": "example name",
    "itemListElement": [
        {
            "@type": "ListItem",
            "position": 1,
            "item": {
                "name": "Segment Rings",
                "description": "Our seamless and segment rings are sold in different styles. There are segment rings which include a loose section that is clicked in place after insertion into the piercing and there are hinged segment rings, of which the section is attached to the ring. Both versions give the appearance of a continuous ring when inserted. Those segment and hinged segment rings are sold in PVD-plated and anodized versions and the gauges vary from 16g (1.2mm) to 4g (5mm). The diameters range from 6mm to 16mm.",
                "url": "https://www.achadirect.com/en/wholesale-seamless-and-segment-rings/others",
                "image": "https://wholesalebodyjewellery.co.uk/wp-content/uploads/2021/05/element-titanium-seamless-segment.jpg"
            }
        },
        {
            "@type": "ListItem",
            "position": 2,
            "item": {
                "name": "Titanium Labrets With Multi-Crystal Balls",
                "description": "Our ASTM F-136 titanium (Ti6Al4V ELI) titanium labrets have a flat back piece that sits flat against the skin and internally threaded balls. They are often used for upper and lower lip piercings, ear piercings and even as nose jewellery. These labrets are ideal for oral use as the back plate does not irritate gums or teeth. The piercing balls are internally threaded.",
                "url": "https://www.achadirect.com/en/wholesale-titanium-g23/labrets",
                "image": "https://wholesalebodyjewellery.co.uk/wp-content/uploads/2021/02/element-titanium-g23-labrets-with-crystal-balls.jpg"
            }
        }
    ]
}

And when i see the the test page HTML it shows the following:

<html>
<head></head>
<body>
{
    &quot;@context&quot;: &quot;https://schema.org&quot;,
    &quot;@type&quot;: &quot;ItemList&quot;,
    &quot;name&quot;: &quot;example name&quot;,
    &quot;itemListElement&quot;: [
        {
            &quot;@type&quot;: &quot;ListItem&quot;,
            &quot;position&quot;: 1,
            &quot;item&quot;: {
                &quot;name&quot;: &quot;Segment Rings&quot;,
                &quot;description&quot;: &quot;Our seamless and segment rings are sold in different styles. There are segment rings which include a loose section that is clicked in place after insertion into the piercing and there are hinged segment rings, of which the section is attached to the ring. Both versions give the appearance of a continuous ring when inserted. Those segment and hinged segment rings are sold in PVD-plated and anodized versions and the gauges vary from 16g (1.2mm) to 4g (5mm). The diameters range from 6mm to 16mm.&quot;,
                &quot;url&quot;: &quot;https://www.achadirect.com/en/wholesale-seamless-and-segment-rings/others&quot;,
                &quot;image&quot;: &quot;https://wholesalebodyjewellery.co.uk/wp-content/uploads/2021/05/element-titanium-seamless-segment.jpg&quot;
            }
        },
        {
            &quot;@type&quot;: &quot;ListItem&quot;,
            &quot;position&quot;: 2,
            &quot;item&quot;: {
                &quot;name&quot;: &quot;Titanium Labrets With Multi-Crystal Balls&quot;,
                &quot;description&quot;: &quot;Our ASTM F-136 titanium (Ti6Al4V ELI) titanium labrets have a flat back piece that sits flat against the skin and internally threaded balls. They are often used for upper and lower lip piercings, ear piercings and even as nose jewellery. These labrets are ideal for oral use as the back plate does not irritate gums or teeth. The piercing balls are internally threaded.&quot;,
                &quot;url&quot;: &quot;https://www.achadirect.com/en/wholesale-titanium-g23/labrets&quot;,
                &quot;image&quot;: &quot;https://wholesalebodyjewellery.co.uk/wp-content/uploads/2021/02/element-titanium-g23-labrets-with-crystal-balls.jpg&quot;
            }
        }
    ]
}
</body></html>

You can see here everything: Rich results test error

php

schema

jsonschema

schema.org

0 Answers

Your Answer

Accepted video resources