json - 标签“架构”中的 JSON 无效
问题描述
我是在 Shopify 中创建部分的新手,并且在标签“架构”错误中收到无效的 JSON。我正在尝试在页脚中创建一个静态部分,其中包含与 URL 链接的标题和图像。任何帮助都感激不尽。
{% 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 %}
解决方案
在我们首先开始部分问题之前,您的 JSON 存在太多问题。
在此处验证您的 JSON:https ://jsonformatter.curiousconcept.com/
以下是一些问题:
,
有不应该存在的尾随,例如"default": "Enter heading text here",
/"default": "Enter url here",
- 您缺少引号 - 示例
id"
/footer-image"
至于 Shopify 部分的问题,URL 字段,没有默认字段,所以这是错误的"default": "Enter url here",
。
您的 JSON 部分应如下所示:
{% 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 %}
推荐阅读
- python - 如果txt文件没有列,如何从文本文件中提取数据?
- abap - 有没有办法防止 CL_SALV_TABLE 删除前导零?
- office365 - getAttachmentsAsync() 不会在回调中为内联附件返回 AttachmentDetailsCompose
- ios - 从列表中获取项目单击
- postgresql - 查询特定表列
- javascript - 如何删除此 CSV 生成器 for 循环中的多余逗号
- python - 从 R 或 python 中的字符串向量创建 0 和 1 的矩阵
- python - 如何在 Python/Terraform 中使用 sqlalchemy 加密服务器端(AWS Aurora serverless v1 数据库)?
- python-3.x - 在 tkinter 中更改已打包小部件的位置
- jsp - 如何从 Hybris 中的控制器调用 jsp 文件?