I have been trying to parse a JSON file. It was somewhat out of structure, so , to get in a structure I am using a subsequence of that file (so that it gets in a structure). But when I am using subsequence or substring, then it is just omitting the starting(first offset) and not the end offset(end is as it is). Here is the code:
String url = "http://earthquake.usgs.gov/earthquakes/feed/geojsonp/2.5/week"; //json file
String response="";
response = getInputStreamFromUrl(url); //getting the response
response= response.subSequence(16, response.length()-2).toString(); //i want to omit the last 2 characters from the string
txt.setText(response); //setting the response in a text view(doing it in android)
I have also tried counting the characters and then setting the end offset, but still it is omitting more than the specified characters.