Questions tagged [jsonexception]

Java Exception that is thrown to indicate a problem with the JSON API, as attempts to parse or construct malformed documents, use of null as a name or type mismatches on lookups.

171 questions
3
votes
1 answer

How to handle JSON that contains strings with bracket?

I'm creating an activity that get a JSON file from internet (via AsyncTask). I'm experiencing this error: org.json.JSONException: Unterminated string at character... I checked the JSON file that I downloaded inside the app and I discovered that…
smartmouse
  • 13,912
  • 34
  • 100
  • 166
3
votes
2 answers

Check if JSONObject key exists

I'm making api calls to a back-end who always has a JSONArray series and sometimes has a JSONArray places. In the code below, I am trying to write an if statement that says, whenever there is no places array, make another http request. However, I am…
Rafa
  • 3,219
  • 4
  • 38
  • 70
3
votes
3 answers

How can JSONObject.toString(int) throw JSONException?

I noticed this in the JSONObject.toString(int) documentation Throws: JSONException - If the object contains an invalid number. How could the object contain an invalid number if the NaN/Infinity check is done beforehand (either at parsing and in…
ris8_allo_zen0
  • 1,537
  • 1
  • 15
  • 35
3
votes
2 answers

Error parsing data org.json.JSONException: End of input at character 10 of

I am currently stuck at this error "Error parsing data org.json.JSONException: End of input at character 10 of". I tested my PHP with Chrome's Plugin Postman and the server-side seems to be fine. Please view code below and thank you for your…
thienwgu
  • 69
  • 2
  • 3
  • 7
2
votes
1 answer

Wiremock stubbing error: "Unrecognized field \"timestamp\" (class com.github.tomakehurst.wiremock.common.Errors), not marked as ignorable"

here I come because I have not found any solution to my problem. I'm actually trying to stub a response with wiremock (that call to the Mocked service is be done via FeignClient). My intention is to get a fake response with the real feign client,…
2
votes
1 answer

org.json.JSONException: Missing value at character 1

I am having an escaped string in a variable and I am trying to make JSON object out of the string. It's throwing the Exception which looks like this : org.json.JSONException: Missing value at character 1 After thorough research, I couldn't find an…
praneeth
  • 21
  • 1
  • 3
2
votes
1 answer

How to get string response from php using android volley JsonObjectRequest?

ctually when we call API and send request in JSON format we are expecting response also come into JSON format. But here back end team sending me response in String format therefore my onErrorResponse () method get called. Here my status code is 200.…
2
votes
2 answers

Getting JSONException?

I was trying to parse the below json and caught JSONException at line 150(marked in code) and I am unable to figure out why it happened. Objective is to find list of tests of a particular package and store it in an arraylist. When I passed…
Gagan Batra
  • 363
  • 1
  • 2
  • 15
2
votes
0 answers

org.json.JSONException: End of input at character 1

I am trying to post data to server using Volley.I got a JsonException.I have no idea about it.I check if length of "response" is greater than 0.Then I log the response, but the response is not being displayed.Has anyone encountered such a problem…
jobin
  • 1,489
  • 5
  • 27
  • 52
2
votes
5 answers

org.json.JSONException: Value at org.json.JSON.typeMismatch

I am parsing some data from a link which contains the list of premier league table. I like to use it to show in a list view. But I get JSONException and JSON.typeMismatch errors. Below is my code: public class ParseJSON { public static…
Deepak S
  • 183
  • 1
  • 10
2
votes
1 answer

Error parsing JSON value

I received the error: JSON Parser﹕ Error parsing data org.json.JSONException: Value Success of type java.lang.String cannot be converted to JSONObject at success = json.getBoolean(SUCCESS); I searched around SO and the Internet and I am still not…
JohnWilliams
  • 139
  • 1
  • 13
2
votes
1 answer

How to add jar files and compile using command prompt? (Error: A JNI error has occured,Please Check your Installation)

I forked one project from github and when i want to run it gives error. I added org.json jar file to jdk\lib and also set the Path variable to it. I compiled code but it got no errors but when i run it i get exception as follows : (and I am running…
Pratik
  • 88
  • 1
  • 2
  • 11
2
votes
1 answer

Android - Validating JSON when getting a response from a server to avoid a JSONException

In some of my applications that talk to a server and get a response using http I use json to format the data server side and when it gets to the device I use something similar to this code which I found on stackoverflow: private class LoadData…
James andresakis
  • 5,335
  • 9
  • 53
  • 88
1
vote
2 answers

How to encode Map into Json in Dart?

I am trying to convert Map into json with following code: String ecoded = json.encode({ DateTime.now(): ["Sample data", 3,true,"Example", 2], }); But compiler give following error: E/flutter (11773):…
Zilaid
  • 464
  • 6
  • 22
1
2
3
11 12