• Resolved kiruba92

    (@kiruba92)


    When we print the JSON value and it is getting below error in woo commerce as No JSON object could be decoded. Any one suggest good answer.

    Code:

    wcapi = API(
       url="https://www.example.com/",
       consumer_key="xxxx",
       consumer_secret="yyyy",
       wp_api=True,
       version="wc/v2",
       query_string_auth= True,
    )

    While running the below code

    pprint(wcapi.get(""))

    It getting <Response [200]>.

    pprint(wcapi.get("orders/19895").json())

    Error:

    Traceback (most recent call last):
    File “test.py”, line 41, in <module>
    pprint(wcapi.get(“orders/19895”).json())
    File “/home/harmony/virt/10.0-LS/local/lib/python2.7/site-packages/requests/models.py”, line 826, in json
    return complexjson.loads(self.text, **kwargs)
    File “/usr/lib/python2.7/json/__init__.py”, line 339, in loads
    return _default_decoder.decode(s)
    File “/usr/lib/python2.7/json/decoder.py”, line 364, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
    File “/usr/lib/python2.7/json/decoder.py”, line 382, in raw_decode
    raise ValueError(“No JSON object could be decoded”)
    ValueError: No JSON object could be decoded

    • This topic was modified 6 years, 1 month ago by kiruba92.
Viewing 1 replies (of 1 total)
  • Shane Eckert

    (@shaneeckert)

    Automattic Happiness Engineer

    Howdy!

    That is strange. You are getting a 200, yet the error makes it sound like you are getting something returned that is not recognized.

    What if you trying using V3 and do a simple test, just to rule out this being an issue with WooCommerce. (https://woocommerce.github.io/woocommerce-rest-api-docs/#order-properties)

    Can you test using a client and see if you get any errors when you try https://example.com/wp-json/wc/v3/orders/19895?

    Thank you,

Viewing 1 replies (of 1 total)
  • The topic ‘Woocommerce No JSON object could be decoded error’ is closed to new replies.