I'm trying retrive server json data.
My code: MainActivity
String url = "http://........com/...../...."
String[] params = new String[]{url};
JSONParser jsonParser = new JSONParser();
try {
String response = jsonParser.execute(url).get();
JSONArray jsonArray = new JSONArray(response);
JSONObject jsonObje = (JSONObject) jsonArray.get(0);
}
JSONParser.JAVA
HttpURLConnection connection = null;
BufferedReader reader = null;
String responseText="";
try {
URL url = new URL(params[0]);
connection = (HttpURLConnection) url.openConnection();
connection.connect();
//GIVE ERROR THIS LINE!
InputStream stream = connection.getInputStream();
//ERROR LINE!
reader = new BufferedReader(new InputStreamReader(stream));
Error: org.json.JSONException: End of input at character 0 of
Json file:
{"PersonelID":2,"PersonelAdıSoyadı":"New Driver","PersonelTelefon":"","PersonelMail":"driver@mail.com","PersonelPassword":null,"PersonelTipi":1,"AracID":0,"SirketID":20,"SuccessCode":1}