I request a servlet and it returns me JSON structure correctly but combined with "null"
null{"name":Maria,"totalPrice":17.49}
How can I remove null value in the first line?
I am using the following code to get JSON-Servlet
:
BufferedReader reader = new BufferedReader(new InputStreamReader(
((HttpURLConnection) (new URL(the_url)).openConnection()).getInputStream(),
Charset.forName("UTF-8")));
String line;
String returnString = null;
while ((line = reader.readLine()) != null) {
returnString += line;
}
reader.close();
out.write(returnString);