I want to this kind of Json Parsing which is provide in below and fetch the data from Json Parsing Data. But it give me NullPointer Exception whenever Execute my code(Do in Background Process) Which is provided in below. How to solve this problem? How to get the JSON Response from this below URL?
data = {"2015-03-06":[{"date":"2015-03-06","sign":"0"}]};
My Code is,
@Override
urlGetData= "view-source:XXXXXXXX?date=YYYY-MM-DD&sign=2XXXX";
protected Void doInBackground(Void... arg0) {
dataList = new ArrayList<HashMap<String, String>>();
// Retrieve JSON Objects from the given URL address
jsonobject = JSONFunctions.getJSONfromURL(urlGetData);
try {
jsonarray = jsonobject.getJSONArray("YYYY-MM-DD");
for (int i = 0; i < jsonarray.length(); i++) {
HashMap<String, String> map = new HashMap<String, String>();
jsonobject = jsonarray.getJSONObject(i);
// Retrive JSON Objects
strRating = String.valueOf(jsonobject
.getString("rating"));
dataList.add(map);
}
} catch (JSONException e) {
Log.e("Error", e.getMessage());
e.printStackTrace();
}
return null;
}
But it gives me Null Pointer Exception on jsonarray = jsonobject.getJSONArray("YYYY-MM-DD").
How can get theresponse of data = {"2015-03-06":[{"date":"2015-03-06","sign":"0"}]};?
Thanks.