Error: Invalid JSON in tag 'schema'

Solved
Riddhish
New Member
1 0 0

Hello,

 

I'm trying to add a logo block to my existing related collections block within a section in the product.liquid file and keep getting an error. 

 

{%- for block in section.blocks -%}
  {% for block in section.blocks %}
    <li class="logo-bar-section" {{ block.shopify_attributes }}>
      {% if block.settings.link != blank %}
        <a href="{{ block.settings.link }}">
      {% endif %}
      {% if block.settings.image != blank %}
        {{ block.settings.image | img_url: '150x150', scale: 2 | img_tag: block.settings.image.alt, 'logo-bar__image' }}
      {% else %}
        {{ 'logo' | placeholder_svg_tag: 'placeholder-svg' }}
      {% endif %}
      {% if block.settings.link != blank %}
        </a>
      {% endif %}
    </li>
  {% endfor %}
 {% assign related_collection = collection %}
  {% assign product_count = block.settings.product-count | times: 1 %}
  {% if collection == null or collection.handle == 'frontpage' or collection.handle == 'all' %}
    {% assign collection_found = false %}
    {% for c in product.collections %}
      {% if collection_found == false and c.handle != 'frontpage' and c.handle != 'all' %}
        {% assign collection_found = true %}
        {% assign related_collection = c %}
        {% break %}
      {% endif %}
    {% endfor %}
  {% endif %}
  {% if related_collection.products.size > 0 %}
    <section class="section-related-products" {{ block.shopify_attributes }}>
      <span class="related-products-title">{{ 'related_products.title' | t }}</span>
      {%-
        include 'product-highlights',
        collection: related_collection,
        product_item_style: block.settings.product_item_style,
        use_quickshop: block.settings.enable_product_quickshop,
        products_per_row: product_count,
        products_row_count: 1,
        product_emphasize: block.settings.product_emphasize
      -%}
    </section>
  {%- endif -%}
{%- endfor -%}

{% schema %}
{
  "name": "Product pages",
  "class": "section-product",
  "settings": [
    {
      "type": "checkbox",
      "id": "enable_menu_form",
      "label": "Enable bottom menu",
      "default": true,
      "info": "Displays product options and breadcrumbs in a sticky bottom menu."
    },
    {
      "id": "show_product_vendor",
      "type": "checkbox",
      "label": "Show product vendor",
      "default": false
    },
    {
      "type": "checkbox",
      "id": "enable_cart_redirection",
      "label": "Enable cart redirection",
      "info": "Automatically sends users to the Cart page after adding a product.",
      "default": false
    },
    {
      "type": "checkbox",
      "id": "show_payment_button",
      "label": "Show dynamic checkout button",
      "info": "Each customer will see their preferred payment method from those available on your store, such as PayPal or Apple Pay. [Learn more](https://help.shopify.com/manual/using-themes/change-the-layout/dynamic-checkout)",
      "default": true
    },
    {
      "type": "header",
      "content": "Sharing"
    },
    {
      "type": "checkbox",
      "id": "enable_social_sharing",
      "label": "Enable social sharing",
      "default": false
    }
  ]
 },
{
  "blocks": [
    {
      "type": "logo_image",
        "name": "Logo",
        "settings": [
          {
            "type": "image_picker",
            "id": "image",
            "label": "Image"
          },
          {
            "type": "url",
            "id": "link",
            "label": "Link",
            "info": "Optional"
          }
        ],
	  },
	{
	  "type": "related_products",
      "name": "Related products",
      "settings": [
        {
          "id": "product_item_style",
          "type": "select",
          "label": "Product aspect ratio",
          "info": "Using an uncropped setting will generate white space around the image to create a uniform grid without cropping your image. The background in the editor indicates the applied white space, but will not appear on your storefront.",
          "options": [
            { "group": "Uncropped", "value": "natural", "label": "Natural" },
            { "group": "Uncropped", "value": "small", "label": "Short (4:3)" },
            { "group": "Uncropped", "value": "medium", "label": "Square (1:1)" },
            { "group": "Uncropped", "value": "large", "label": "Tall (2:3)" },
            { "group": "Cropped", "value": "cropped-small", "label": "Short (4:3)" },
            { "group": "Cropped", "value": "cropped-medium", "label": "Square (1:1)" },
            { "group": "Cropped", "value": "cropped-large", "label": "Tall (2:3)" }
          ],
          "default": "natural"
        },
        {
          "id": "enable_product_quickshop",
          "type": "checkbox",
          "label": "Enable product quickshop",
          "default": false
        },
        {
          "id": "product-count",
          "type": "range",
          "label": "Products",
          "min": 1,
          "max": 5,
          "step": 1,
          "default": 5
        },
        {
          "id": "product_emphasize",
          "type": "checkbox",
          "label": "Emphasize product",
          "info": "Creates an alternate layout on larger screens",
          "default": true
        }
      ]
     }
    ]
  }

{% endschema %}

 

 

0 Likes
HunkyBill
Shopify Expert
4355 36 462

This is an accepted solution.

Copy and paste your JSON into a code formatter like this one.

 

https://jsonformatter.curiousconcept.com/

 

You will instantly have three errors to click on, and you'll be fixing them in about 10 seconds... as the error is dead simple. 

 

For example, you have a ],}, in there... totally invalid JSON.

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com
Eudo
New Member
1 0 0

Hello, I'm tring to create a new section with this code but this is the error I got, help !

Liquid syntax error: Unexpected character â in "{{ block.settings.image | img_url: “compact” }}"

 

 

<div class=”page-width” id=”home-testimonials” data-section-id=”{{ section.id }}” data-section-type=”quotes”>
{% if section.settings.title != blank %}
<div class=”section-header text-center”>
<h2>{{ section.settings.title | escape }}</h2>
</div>
{% endif %}

{% if section.blocks.size > 0 %}
<div class=”quotes-wrapper”>
<div class=”quotes-slider testisec” id=”Quotes-{{ section.id }}” data-count=”{{ section.blocks.size }}”>
{% for block in section.blocks %}
<div class=”quotes-slide–{{ block.id }}” {{ block.shopify_attributes }}>
<div class=””>
{% if block.settings.image != blank %}
<img src=”{{ block.settings.image | img_url: “compact” }}” alt=”{{ block.settings.image.alt | escape }}” class=”testimonial-img” style=”border-radius: 50%;” />
{% else %}
{{ ‘image’ | placeholder_svg_tag: ‘placeholder-image’ }}
{% endif %}
</div>
<div class=”testimonial-content grid__item large–two-thirds medium-down–text-center”>
<span>{{ block.settings.testimonial-provider }}</span>
<span>{{ block.settings.testimonial-location }}</span>
<p>
{{ block.settings.testimonial-content | escape }}
</p>

</div>

</div>
{% endfor %}
</div>
</div>
{% endif %}
</div>

{% schema %}
{
“name”: “Testimonials”,
“class”: “index-section”,
“max_blocks”: 20,
“settings”: [
{
“type”: “text”,
“id”: “title”,
“label”: “Header”,
“default”: “Testimonials”
}
],
“presets”: [{
“name”: “Testimonials”,
“category”: “Text”,
“blocks”: [
{
“type”: “text”
},
{
“type”: “text”
},
{
“type”: “text”
},
{
“type”: “text”
}
]
}],
“blocks”: [
{
“type”: “text”,
“name”: “Testimonial Content”,
“settings”: [
{
“type”: “image_picker”,
“id”: “image”,
“label”: “Client Image”,
“info”: “Recommended size: 160×160”
},
{
“type”: “text”,
“id”: “testimonial-content”,
“label”: “Clients Testimonial”,
“default”: “This is some amazing content. Make sure to read all of it and become inspired by it too!”
},
{
“type”: “text”,
“id”: “testimonial-provider”,
“label”: “Clients Name and Title”,
“default”: “- By some amazing author”
},
{
“type”: “text”,
“id”: “testimonial-location”,
“label”: “Clients Location”,
“default”: “London,UK”
}

]
}
]
}
{% endschema %}

{% stylesheet %}

/*put required style here*/

{% endstylesheet %}

0 Likes
2FlyCreations
New Member
2 0 0

Eudo.. did you get this resolved?

I am trying to get this done as well...

Please let me know.

Thank you.

0 Likes
Mansour147
New Member
1 0 0

Hello @HunkyBill i am facing the same issue but i have no technical expertise i would appreciate if you could assist me. i am trying to add this code in product-template.liquid 

<div class="text-center" style="margin-top: 1rem;">
<img src="https://cdn.shopify.com/s/files/1/0509/2704/2753/files/Puteq_Logo_V10_d9c7d556-1f2d-47bc-9920-8e2be5...
"/></div>

But after trying to save ill get the Invalid JSON in tag 'schema' Error which then makes me realize that there are bunch of wrong codes in there. 

Would appreciate if anyone can assist. 

0 Likes
polyprod1
New Member
1 0 0

"<div class=""text-center""style=""margin-top: 1rem;"">
<img src=""https://cdn.shopify.com/s/files/1/0509/2704/2753/files/Puteq_Logo_V10_d9c7d556-1f2d-47bc-9920-8e2be5...
""/></div>"

0 Likes
2FlyCreations
New Member
2 0 0
Thank you so much.
0 Likes