【发布时间】:2019-05-20 14:58:59
【问题描述】:
我有一个多年来一直使用 POST to API 函数在 Shopify 上创建产品的 VBA 文件。它突然在 2019 年 4 月 15 日左右因不明原因停止工作。它给出了以下错误:
"error": "822: [我的 JSON 字符串] 出现意外标记
这是 JSON 字符串的样子(您可以在本文末尾找到更完整的字符串):
{
"product": {
"title": "Lunettes",
"body_html": "some long text",
"vendor": "Tom Ford",
"product_type": "lunettes enfant adolescents",
"published": false,
"tags": "some tags",
"variants": [
{
"option1": "default title",
"price": "199",
"sku": "1",
"weight_unit": "g"
}
],
"options": [
{
"name": "title",
"position": 1,
"values": [
"default title"
]
}
]
}
}
我已经尝试过的:
使用正确的 API 密钥和令牌/密码检查 URL
尝试将最新发布的 Shopify API 版本添加到 CURL:2019-04
检查 JSON 字符串的语法(逗号、{ 等)
基本上尝试了我所知道的一切。如果您有任何线索,请提供帮助。
更完整的 Json_String 是:
{"product":{"title":"Lunettes TF5501 ","body_html":"TEXT,<div style=\"text-align: center;\"><img alt=\"Dimensions Lunettes Varionet TF5501 Argent\" src=\"https://cdn.shopify.com/s/files/1/0855/6878/files/Lunettes.png?15354686291941720795\" style=\"float: none; display: block; margin-left: auto; margin-right: auto;\" /></div><div style=\"overflow-x: auto;\"> <table width=\"100%\"> <tbody><tr style=\"background-color: #98ffaf;\"><td style=\"text-align: center;\">140 mm</td><td style=\"text-align: center;\">54 mm</td><td style=\"text-align: center;\">38 mm</td><td style=\"text-align: center;\">18 mm</td><td style=\"text-align: center;\">145 mm</td></tr></tbody></table></div>","vendor":"Brand","product_type":"lunettes anti lumière bleue","published":false,"tags":"meta-filter-Marque-Varionet,meta-filter-Forme-Rectangle,meta-filter-Genre-Unisex,meta-filter-Genre-Homme,meta-filter-Genre-Femme,meta-filter-Couleur-Argent","variants":[{"option1":"default title","price":"199","sku":"tom ford tf5501016","position":1,"grams":"100","inventory_policy":"deny","compare_at_price":"339","fulfillment_service":"logisticien-mavu","inventory_management":"shopify","option_1":"default title","requires_shipping":true,"taxable":true,"inventory_quantity":1,"weight_unit":"g"}],"options":[{"name":"title","position":1,"values":["default title"] }]
}}
谢谢!
你的
【问题讨论】:
-
通常你可能会意外添加一个被解析器读取的字符并搞砸了,但你不能轻易看到它。此错误不是来自 Shopify,而是源自您的请求代码。仔细检查您的数据是否有奇怪的字符。此外,其他有同样问题的人通过修复他们的标题解决了这个问题。确保你的也是正确的。 community.shopify.com/c/Shopify-APIs-SDKs/…
-
查看实际代码会有所帮助(无需您的个人凭据)