• Register
0 votes
223 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:

“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

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.

OR

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 254 views
254 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 mphil 2.3k points
0 votes
1 answer 49 views
49 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 298 views
298 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 jwilliam 3.9k points
0 votes
1 answer 12 views
12 views
Can someone explain me why i am seeing this error that told me to use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1 path $. How to solve it and what is reason behind this error?
asked Sep 14 Daniel Anderson 4k points