Ad

Invalid JSON In Tag 'Schema'

- 1 answer

I am new to creating sections in Shopify and I am getting an invalid JSON in tag 'schema' error. I am trying to create a static section in my footer with a heading and image that links with a URL. Any help will be much appreciated.

{% schema %}
  {
    "name": "Footer Image",
    "class": "image",
    "settings":     [
                {
            "id":"footer-image-heading",
            "type":"text",
            "label":"footer-image-heading",
            "default": "Enter heading text here",
        },

                {
            id":"footer-image",
            "type":"image_picker",
            "label":footer-image",
            
        },

                {
            id":"footer-image-url",
            "type":"url",
            "label":"footer-image-url",
            "default": "Enter url here",
            
        },
    ]
}
{% endschema %}
Ad

Answer

There are too many issues with your JSON before we begin with the section issue first.

Validate your JSON here: https://jsonformatter.curiousconcept.com/

Here are some of the issues:

  • there are trailing , that shouldn't be there, example "default": "Enter heading text here", / "default": "Enter url here",
  • you have missing quotes - example id" / footer-image"

As for the Shopify section issue, URL fields, doesn't have a default field, so this is wrong "default": "Enter url here",.

Your section JSON should look like this:

{% schema %}
  {
    "name": "Footer Image",
    "class": "image",
    "settings":     [
        {
            "id":"footer-image-heading",
            "type":"text",
            "label":"footer-image-heading",
            "default": "Enter heading text here"
        },

        {
            "id":"footer-image",
            "type":"image_picker",
            "label":"footer-image"
        },

        {
            "id":"footer-image-url",
            "type":"url",
            "label":"footer-image-url"
        }
    ]
}
{% endschema %}
Ad
source: stackoverflow.com
Ad