[REST API] Invalid JSON when creating product
-
I get a json error when creating products
An example request body is
{ "type" : "variable", "name" : "Centauri COVID-19 Strip Laminated Anti-Slip Floor Vinyl (Set of 12)", "description" : "<p>Full-colour high-resolution digital print on removable self-adhesive vinyl and laminated with a durable Anti Slip 200 Micron Floor Lamination and machine trim to size.</p> <ul> <li>assembled: 800 (w) x 80 (h)</li> <li>print media: removable self-adhesive vinyl <ul> <li>120gsm</li> </ul> </li> <li>lamination media weight: 200 micron</li> </ul>", "short_description" : "<p>Full-colour high-resolution digital print on removable self-adhesive vinyl and laminated with a durable Anti Slip 200 Micron Floor Lamination and machine trim to size.</p> <ul> <li>assembled: 800 (w) x 80 (h)</li> <li>print media: removable self-adhesive vinyl <ul> <li>120gsm</li> </ul> </li> <li>lamination media weight: 200 micron</li> </ul>", "categories" : [ { "id" : "8039"}], "sku" : "DISPLAY-0362","attributes" : [ { "id" : "7", "name": "Colour", "position" : 0, "visible" : true, "variation": true, "options" : [ "Blue","Green","Grey","Red","Yellow"]}, { "id" : "8", "name": "Size", "position" : 1, "visible" : true, "variation": true, "options" : [ "default"]} ],"stock_status" : "instock", "images" : [{ "src" : "https:\/\/productcatalogue2015.s3.amazonaws.com\/DISPLAY-0362_260_250.jpg" }], "price" : "275.862", "regular_price" : "275.862"}
The response i get is `rest_invalid_json
Invalid JSON body passed. json_error_code 3
Control character error, possibly incorrectly encoded`Indeed i get an error also on json validators, but it’s confusing
Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '[', got 'undefined'
This is actually a JSON related questionWhat are the wrong control characters in question that cause the error?
p.s. actually the “<” and “>” characters are replaced by entities in the original request body, here you see them as < and >
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘[REST API] Invalid JSON when creating product’ is closed to new replies.