Python Forum
JSONDecodeError: Expecting value
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
JSONDecodeError: Expecting value
#1
Hi,

I'm trying to read json content from a url, however, it is displaying the below error in spite of status 200 (<Response [200]>).

JSONDecodeError: Expecting value

Below is the code:

jUrl_dummy = 'https://abc.dummy.com/rest/api/latest/search?fields=%s&query=%s'
fields_dummy = 'key,summary'
username = credentials.login['username']
password = credentials.login['password']
query_dummy = ('project = xxx')
r_dummy = requests.get(jUrl_dummy % (fields_dummy, query_dummy), auth = (username, password))
print(r_dummy)
j_dummy = r_dummy.json() --> This gives the error
Can someone please help with the resolution?
Larz60+ write Mar-07-2022, 01:54 PM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Fixed for you this time. Please use BBCodes on future posts.
Reply
#2
Just because the server thinks that the query and the server's response was correct (200), doesn't mean that the response is json or that the server's response was bug-free.

Have you examined r_dummy.text or r_dummy.contentto see what the content looks like? (Although in this case it appears to be sending no data).

Could it be sending a cookie instead (which is then to be used for later requests)?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How can i fix json.decoder.JSONDecodeError ? JgKSuperstar 9 4,490 Oct-30-2021, 11:23 PM
Last Post: JgKSuperstar
  Problems with JSONDecodeError arsouzaesilva 0 1,391 Sep-22-2021, 06:33 PM
Last Post: arsouzaesilva
  Pyspark SQL Error - mismatched input 'FROM' expecting <EOF> Ariean 3 47,828 Nov-20-2020, 03:49 PM
Last Post: Ariean
  TypeError: size; expecting a recognized type filling string dict a11_m11 0 2,487 Feb-10-2020, 08:26 AM
Last Post: a11_m11

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020