• Register
0 votes
673 views

Problem :

I am facing error “Expecting value: line 1 column 1 (char 0)” when trying to decode the JSON.The URL I use for a API call works fine in a browser, but gives above error when done through the curl request. The error happens at the return simplejson.loads(response_json)

7 5 2
3,870 points

Please log in or register to answer this question.

1 Answer

0 votes

Solution :

 The solution is as below:

· There is no need to use a simplejson library, a same library is included with Python as a json module.

· There is no need to decode the response from a UTF8 to unicode, a simplejson / json .loads() method can handle UTF8 encoded data natively.

· pycurl has the very archaic API. Unless you have the specific requirement for using it, there are many other choices.

requests offers a most friendly API, including a JSON support. If you can, replace a call with:

import requests
return requests.get(url).json()

 OR

Check a response data-body, whether actual data is present and the data-dump appears to be a well-formatted.

In most cases a json.loads- JSONDecodeError: Expecting value: line 1 column 1 (char 0) error is due to below factors:

· A non-JSON conforming quoting

· XML/HTML output (that is, the string starting with <), or

· A incompatible character encoding

Ultimately an error tells you that at a very first position the string already doesn't conform to the JSON.

9 7 4
38,600 points

Related questions

0 votes
1 answer 386 views
386 views
Problem: I am using google geocode API to test the following Python3.5 code but receive the error below. raise JSONDecodeError("Expecting value", s, err.value) from None >JSONDecodeError: Expecting value
asked Jan 26 Mashhoodch 13k points
0 votes
1 answer 1 view
1 view
Problem: How do I do this "json.decoder.jsondecodeerror: expecting value: line 1 column 1 (char 0)"?
asked 2 days ago padma1 22.4k points
0 votes
1 answer 2 views
2 views
Problem: I need your asnwer to fix of jsondecodeerror: expecting value: line 1 column 1 (char 0).
asked 2 days ago padma1 22.4k points
0 votes
1 answer 3 views
3 views
Problem: Any one have idea to fix this 'expecting value: line 1 column 1 (char 0)' ?
asked 2 days ago padma1 22.4k points
0 votes
1 answer 4 views
4 views
Problem: Please help me to solve it. what is the value stored at x, given the statements:?
asked Mar 23 Ifra 24.4k points
0 votes
2 answers 10.3K views
10.3K views
Problem : I am trying to figure out the good way to load the JSON objects in the Python. I send below json data: {'http://example.org/about': {'http://purl.org/dc/terms/title': [{'type': 'literal', 'value': "Anna's Homepage"}]}} To my backend where it ... 1 column 2 (char 1)&rdquo; I did lot of research on it but nothing seems to work for me. Any suggestions on my issue will be much appreciated.
asked Jan 7, 2020 alecxe 7.5k points
0 votes
1 answer 5 views
5 views
Problem: how to I Solve this: valueerror: expecting property name: line 1 column 2 (char 1) HELP! I need help understanding this: valueerror: expecting property name: line 1 column 2 (char 1) Can someone please help solve this, I am new in python(). Someone have idea to solve this thanks!
asked Mar 10 Mashhoodch 13k points
0 votes
1 answer 43 views
43 views
Problem: I've been trying to figure out a good way to load JSON objects in Python. I send this json data: {'http://example.org/about': {'http://purl.org/dc/terms/title': [{'type': 'literal', 'value': "Anna's Homepage"}]}} to the backend where it ... seems for me not that efficient since it accept any kind of data even the ones that are not in json format. Any suggestions will be much appreciated.
asked Feb 23 Mashhoodch 13k points
0 votes
1 answer 333 views
333 views
Problem : According to the following documents: https://developer.twitter.com/en/docs/tweets/timelines/api-reference/get-statuses-user_timeline.html I have the oauth user token and the user token secret, plus I have my app credentials... The docs state that the ... is supported by Twitter, but how should I include it in the get requests for screen names those are not publicly accessible?
asked Nov 25, 2019 alecxe 7.5k points
0 votes
1 answer 613 views
613 views
Problem : Currently I am trying to display a JSON content using a API key. But I am unable to get a authentication. I am facing below error in my JsonObject: &ldquo;Org.json.JSONException: Value Authorization of type java.lang.String cannot be converted to JSONObject&rdquo; In my ... to pass a API key and URL id to get my JSON response in a URL. I display a JSON content using a JSON array.
asked Feb 2, 2020 jwilliam 3.9k points