0

我正在使用 Shopify API 在 Shopify 上发布产品。当我在我的 http_request 的 body_html 中添加一个冗长的详细信息时(它以 JSON 格式获取数据)。我想提供包含特殊字符的完整细节请给我任何解决方案。

我的代码是这个

 {"product":{"title":"Premium LCD Digital Multimeter","body_html":"Premium LCD Digital Multimeter

New Digital Multimeter is an electronic measuring instrument that combines all your most commonly used measurement functions into one unit. This Multimeter comes with measurement and testing functions for voltage, current, resistance, continuity (the connection between two points), testing diodes, and temperature

This Digital Multimeter is a must have testing tool for your toolbox, shed, garage, car trunk, etc. Its portability enables you to be able to take it with you wherever you go and provides you with a multitude of features that helps you achieve the best results every time

Features:

* LCD Display
* Auto power off
* Digital Multimeter
* Handheld Multimeter
* Great tool bag accessory
* Great hardware hacking and reverse engineering
* Portable and versatile, easy to carry around and fits neatly in your tool bag
* Multiple testing functions, diode testing, AC/DC testing, temperature, continuity
* Perfect for home DIY en","product_type":"","vendor":"Abdur Rehman","tags":"blue,green,red","options":[],"images":[
  {
    "src": "https://business.tradingzon.com/images/itemimages/15Json Turneryg1 (261).jpg"
  },
  {
    "src": "https://business.tradingzon.com/images/itemimages/15Json Turneryg2 (159).jpg"
  },
  {
    "src": "https://business.tradingzon.com/images/itemimages/15Json Turneryg3 (143).jpg"
  }
],"variants":[
  {
    "title": "Default Title",
    "barcode": "dsfsr4353",
    "inventory_quantity": 1,
    "option1": "Default Title",
    "price": 10.69,
    "weight": 0.4,
    "weight_unit": "kg",
    "sku": "JSN-YG-02-090",
    "grams": 400,
    "tracked": "true",
    "compare_at_price": 15.45, 
    "inventory_policy": "continue"
  }
]}}
4

1 回答 1

0

简单的。您的描述字段的 JSON 格式不正确。没有换行符,您必须使用“\n”语法告诉 JSON 处理器这是一个换行符。一个有用的工具 - https://jsonlint.com/

于 2020-11-05T13:12:14.607 回答