• Register
0 votes

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:

“Org.json.JSONException: Value Authorization of type java.lang.String cannot be converted to JSONObject”

In my android application, I just want 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.

7 5 2
3,870 points

Please log in or register to answer this question.

1 Answer

0 votes

Solution :

Based on your HTML response, I can surely tell you that this is not the JSON. A response tells me that you have a incorrect URL for a web service.

You need to check the URL.

Also it looks like a simple answer is a right one - your result is not the valid JSON string. Please see JSON.org website for more details on what the JSON should look like.

Check out JSON Parser Online  I know it is very useful when you are working with JSON.

It is very strange that you are requesting the JSON, and it is not returning it properly.


Remove your docType from API. and you must set content Type as Application/json . (because a text/html will not be read as json . so you were seeing the error.)

9 7 4
38,600 points

Related questions

0 votes
1 answer 82 views
Problem: org.json.jsonexception: value <br of type java.lang.string cannot be converted to jsonobject
asked Feb 18 Lucky Guy 1.5k points
0 votes
1 answer 40 views
Problem: What produced the error (&ldquo;Type java.lang.string cannot be converted to jsonobject android.&rdquo;)?
asked Mar 31 zayed1 35.6k points
0 votes
1 answer 329 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 669 views
Problem : I am very new to Spring Boot. I am learning to write code in Spring Boot. I have written my first Spring Boot code as below @RequestMapping(value = "/bar/foo", method = RequestMethod.GET) public MyResponseEntity<foo> foo() { Foo model; ... return ... .core</groupId> <artifactId>jackson-databind</artifactId> <version>2.4.3</version> </dependency> How can I fix above Spring Boot exception?
asked Feb 29, 2020 mphil 2.3k points
0 votes
1 answer 384 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 673 views
Problem : I am facing error &ldquo;Expecting value: line 1 column 1 (char 0)&rdquo; 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)
asked Jan 20, 2020 jwilliam 3.9k points
0 votes
1 answer 48 views
Problem: cannot create a json value from a string with character set 'binary'.
asked Feb 15 Ethan ross 2.7k points
0 votes
1 answer 719 views
Problem : ERROR :Your client does not have permission to get URL
asked Feb 26 Shovo210 13.8k points
0 votes
1 answer 37 views
Problem: Need help with this: Advanced enter your url short url bookmarklet.
asked Mar 23 PkGuy 13.1k points
0 votes
1 answer 9 views
Problem: please solve it question... how to post raw data json using volley in android
asked Apr 1 Ifra 24.4k points