Answer the question
In order to leave comments, you need to log in
How to change response encoding from woocommerce rest api?
With the help of flask and a python script, I receive data, but the response looks like this:
Answer the question
In order to leave comments, you need to log in
The question is not entirely clear, but I can assume this:
import json
with open('json.txt') as file:
json_data = json.loads(file.read())
print(json.dumps(json_data,ensure_ascii=False))
[{"id": 1053, "name": "Наличник 3D Венге рельефный", "slug": "nalichnik-3d-venge-relefnyj", "permalink": "https://site.ru.ru/product/nalichnik-3d-venge-relefnyj/", "date_created": "2017-02-08T16:07:38", "date_created_gmt": "2017-02-08T11:07:38", "date_modified": "2020-05-07T11:28:40", "date_modified_gmt": "2020-05-07T06:28:40", "type": "simple", "status": "publish", "featured": false, "catalog_visibility": "visible", "description": "", "short_description": "", "sku": "17452", "price": "135.00", "regular_price": "135.00", "sale_price": "", "date_on_sale_from": null, "date_on_sale_from_gmt": null, "date_on_sale_to": null, "date_on_sale_to_gmt": null, "price_html": "135.00 р.</span></span>", "on_sale": false, "purchasable": true, "total_sales": 1, "virtual": false, "downloadable": false, "downloads": [], "download_limit": -1, "download_expiry": -1, "external_url": "", "button_text": "", "tax_status": "taxable", "tax_class": "", "manage_stock": false, "stock_quantity": null, "stock_status": "instock", "backorders": "no", "backorders_allowed": false, "backordered": false, "sold_individually": false, "weight": "", "dimensions": {"length": "", "width": "", "height": ""}, "shipping_required": true, "shipping_taxable": true, "shipping_class": "", "shipping_class_id": 0, "reviews_allowed": true, "average_rating": "0.00", "rating_count": 0, "related_ids": [], "upsell_ids": [], "cross_sell_ids": [], "parent_id": 0, "purchase_note": "", "categories": [{"id": 474, "name": "ТестоваяДочерняя1", "slug": "testovayadochernyaya1"}], "tags": [], "images": [{"id": 364, "date_created": "2017-02-06T17:43:11", "date_created_gmt": "2017-02-06T07:43:11", "date_modified": "2017-02-06T17:43:11", "date_modified_gmt": "2017-02-06T07:43:11", "src": "https://site.ru.ru/wp-content/uploads/2017/02/unavailable-3.jpg", "name": "unavailable", "alt": ""}], "attributes": [], "default_attributes": [], "variations": [], "grouped_products": [], "menu_order": 0, "meta_data": [], "_links": {"self": [{"href": "https://site.ru.ru/wp-json/wc/v3/products/1053"}], "collection": [{"href": "https://site.ru/wp-json/wc/v3/products"}]}}]
You are looking at json encoded string
Run it through any json decoder and get human readable data with decoded characters
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question