Код для вызова API такой же, как упоминалось, и метод ответа json. ошибка при вызове объекта json в строке "JSONObject mJsonObj = new JSONObject (response);". Ответ доступен, но ошибка возникает как исключение «Метод сгенерировал» java .lang.StackOverflowError. Невозможно оценить org. json .JSONObject.toString () "
String PROJECT_URL = url+ r.getString(R.string.api_Get_two);
mProgressBar.setVisibility(View.VISIBLE);
StringRequest stringRequest = new StringRequest(Request.Method.POST, PROJECT_URL,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
pendingDataList.clear();
Log.d("JSON", response);
try {
JSONObject mJsonObj = new JSONObject(response); (Error here)
JSONArray pendingChallans = (mJsonObj).getJSONArray("Day");
if(pendingChallans.length() > 0) {
for (int i = 0; i <pendingChallans.length() ; i++) {
PendingData pending = new PendingData();
JSONObject obj = (JSONObject) pendingChallans.get(i);
pending.setRowType(obj.getString("RowType"));
pendingDataList.add(pending);
}
}else {
new Dialogs(mContext, "No Data Found .").createDialogWithMsg();
}
} catch (JSONException e) {
e.printStackTrace();
}finally {
mProgressBar.setVisibility(View.GONE);
pcdRecyclerview.setVisibility(View.VISIBLE);
myAdapter.notifyDataSetChanged();
}
}
JSON:
{
"Day": [{
"RowType": 1,
"Sl": {
"Value": "",
"isBold": 1,
"isItalics": 0,
"Levels": 1,
"Align": 1
},
"Particulars": {
"Value": "PEN ",
"isBold": 1,
"isItalics": 0,
"Levels": 1,
"Align": 1
},
"Value1": {
"Value": "",
"isBold": 0,
"isItalics": 0,
"Levels": 1,
"Align": 1
},
"Value2": {
"Value": "",
"isBold": 0,
"isItalics": 0,
"Levels": 1,
"Align": 1
},
"Value3": {
"Value": "",
"isBold": 0,
"isItalics": 0,
"Levels": 1,
"Align": 1
},
"NextLevelZoomData": "",
"NextLevelZoomType": 0
},
{
"RowType": 2,
"Sl": {
"Value": "SL.",
"isBold": 1,
"isItalics": 0,
"Levels": 1,
"Align": 1
},
"Particulars": {
"Value": "CUS",
"isBold": 1,
"isItalics": 0,
"Levels": 1,
"Align": 1
},
"Value1": {
"Value": "BQty",
"isBold": 1,
"isItalics": 0,
"Levels": 1,
"Align": 1
},
"Value2": {
"Value": "Amount",
"isBold": 1,
"isItalics": 0,
"Levels": 1,
"Align": 1
},
"Value3": {
"Value": "Ood",
"isBold": 1,
"isItalics": 0,
"Levels": 1,
"Align": 1
},
"NextLevelZoomData": "",
"NextLevelZoomType": 0
},
{
"RowType": 3,
"Sl": {
"Value": "1. ",
"isBold": 1,
"isItalics": 0,
"Levels": 1,
"Align": 1
},
"Particulars": {
"Value": "ETH",
"isBold": 0,
"isItalics": 0,
"Levels": 1,
"Align": 1
},
"Value1": {
"Value": "2",
"isBold": 0,
"isItalics": 0,
"Levels": 1,
"Align": 1
},
"Value2": {
"Value": "7",
"isBold": 0,
"isItalics": 0,
"Levels": 1,
"Align": 1
},
"Value3": {
"Value": "165 / 165",
"isBold": 0,
"isItalics": 0,
"Levels": 1,
"Align": 1
},
"NextLevelZoomData": "[{\"UnitFields\":[{\"AllowSort\":1,\"Caption\":\"Challan No.\",\"DisplayOrder\":1,\"Value\":\"2 / 1\",\"Highlight\":0,\"Visible\":1},{\"AllowSort\":1,\"Caption\":\"No. of Days\",\"DisplayOrder\":2,\"Value\":\"153\",\"Highlight\":0,\"Visible\":1},{\"AllowSort\":1,\"Caption\":\"Bal. Qty\",\"DisplayOrder\":3,\"Value\":\"1.00 PCS\",\"Highlight\":0,\"Visible\":0},{\"AllowSort\":1,\"Caption\":\"Item\",\"DisplayOrder\":4,\"Value\":\"WAVE\",\"Highlight\":0,\"Visible\":1},{\"AllowSort\":1,\"Caption\":\"Rate\",\"DisplayOrder\":5,\"Value\":\"398.00\",\"Highlight\":0,\"Visible\":1},{\"AllowSort\":1,\"Caption\":\"Sale\",\"DisplayOrder\":6,\"Value\":\"L A\",\"Highlight\":0,\"Visible\":1},{\"AllowSort\":1,\"Caption\":\"Location\",\"DisplayOrder\":7,\"Value\":\" FLOOR\",\"Highlight\":0,\"Visible\":1},{\"AllowSort\":1,\"Caption\":\"Comment\",\"DisplayOrder\":8,\"Value\":\"SELECTION~\",\"Highlight\":0,\"Visible\":1},{\"AllowSort\":1,\"Caption\":\"Supplier\",\"DisplayOrder\":9,\"Value\":\"gtt\",\"Highlight\":0,\"Visible\":1}],\"Unit\":\"09\"},{\"UnitcodeFields\":[{\"AllowSort\":1,\"Caption\":\"Challan No.\",\"DisplayOrder\":1,\"Value\":\"1/ 1\",\"Highlight\":0,\"Visible\":1},{\"AllowSort\":1,\"Caption\":\"No. of Days\",\"DisplayOrder\":2,\"Value\":\"139\",\"Highlight\":0,\"Visible\":1},{\"AllowSort\":1,\"Caption\":\"Bal. Qty\",\"DisplayOrder\":3,\"Value\":\"1.00 PCS\",\"Highlight\":0,\"Visible\":0},{\"AllowSort\":1,\"Caption\":\"Item\",\"DisplayOrder\":4,\"Value\":\"EMjB\",\"Highlight\":0,\"Visible\":1},{\"AllowSort\":1,\"Caption\":\"Rate\",\"DisplayOrder\":5,\"Value\":\"37,590.00\",\"Highlight\":0,\"Visible\":1},{\"AllowSort\":1,\"Caption\":\"Sale\",\"DisplayOrder\":6,\"Value\":\"L A\",\"Highlight\":0,\"Visible\":1},{\"AllowSort\":1,\"Caption\":\"Location\",\"DisplayOrder\":7,\"Value\":\"MM 1\",\"Highlight\":0,\"Visible\":1},{\"AllowSort\":1,\"Caption\":\"Comment\",\"DisplayOrder\":8,\"Value\":\"PERSONAL\",\"Highlight\":0,\"Visible\":1},{\"AllowSort\":1,\"Caption\":\"Supplier\",\"DisplayOrder\":9,\"Value\":\"GOUR\",\"Highlight\":0,\"Visible\":1}],\"Unit\":\"08\"}]",
"NextLevelZoomType": 2
},
{
"RowType": 3,
"Sl": {
"Value": "2. ",
"isBold": 1,
"isItalics": 0,
"Levels": 1,
"Align": 1
},
"Particulars": {
"Value": "SAE",
"isBold": 0,
"isItalics": 0,
"Levels": 1,
"Align": 1
},
"Value1": {
"Value": "1",
"isBold": 0,
"isItalics": 0,
"Levels": 1,
"Align": 1
},
"Value2": {
"Value": "30",
"isBold": 0,
"isItalics": 0,
"Levels": 1,
"Align": 1
},
"Value3": {
"Value": "1",
"isBold": 0,
"isItalics": 0,
"Levels": 1,
"Align": 1
},
"NextLevelZoomData": "[{\"UnitFields\":[{\"AllowSort\":1,\"Caption\":\"Challan No.\",\"DisplayOrder\":1,\"Value\":\"2 / 1\",\"Highlight\":0,\"Visible\":1},{\"AllowSort\":1,\"Caption\":\"No. of Days\",\"DisplayOrder\":2,\"Value\":\"153\",\"Highlight\":0,\"Visible\":1},{\"AllowSort\":1,\"Caption\":\"Bal. Qty\",\"DisplayOrder\":3,\"Value\":\"1.00 PCS\",\"Highlight\":0,\"Visible\":0},{\"AllowSort\":1,\"Caption\":\"Item\",\"DisplayOrder\":4,\"Value\":\"WAVE\",\"Highlight\":0,\"Visible\":1},{\"AllowSort\":1,\"Caption\":\"Rate\",\"DisplayOrder\":5,\"Value\":\"398.00\",\"Highlight\":0,\"Visible\":1},{\"AllowSort\":1,\"Caption\":\"Sale\",\"DisplayOrder\":6,\"Value\":\"L A\",\"Highlight\":0,\"Visible\":1},{\"AllowSort\":1,\"Caption\":\"Location\",\"DisplayOrder\":7,\"Value\":\" FLOOR\",\"Highlight\":0,\"Visible\":1},{\"AllowSort\":1,\"Caption\":\"Comment\",\"DisplayOrder\":8,\"Value\":\"SELECTION~\",\"Highlight\":0,\"Visible\":1},{\"AllowSort\":1,\"Caption\":\"Supplier\",\"DisplayOrder\":9,\"Value\":\"gtt\",\"Highlight\":0,\"Visible\":1}],\"Unit\":\"09\"},{\"UnitcodeFields\":[{\"AllowSort\":1,\"Caption\":\"Challan No.\",\"DisplayOrder\":1,\"Value\":\"1/ 1\",\"Highlight\":0,\"Visible\":1},{\"AllowSort\":1,\"Caption\":\"No. of Days\",\"DisplayOrder\":2,\"Value\":\"139\",\"Highlight\":0,\"Visible\":1},{\"AllowSort\":1,\"Caption\":\"Bal. Qty\",\"DisplayOrder\":3,\"Value\":\"1.00 PCS\",\"Highlight\":0,\"Visible\":0},{\"AllowSort\":1,\"Caption\":\"Item\",\"DisplayOrder\":4,\"Value\":\"EMjB\",\"Highlight\":0,\"Visible\":1},{\"AllowSort\":1,\"Caption\":\"Rate\",\"DisplayOrder\":5,\"Value\":\"37,590.00\",\"Highlight\":0,\"Visible\":1},{\"AllowSort\":1,\"Caption\":\"Sale\",\"DisplayOrder\":6,\"Value\":\"L A\",\"Highlight\":0,\"Visible\":1},{\"AllowSort\":1,\"Caption\":\"Location\",\"DisplayOrder\":7,\"Value\":\"MM 1\",\"Highlight\":0,\"Visible\":1},{\"AllowSort\":1,\"Caption\":\"Comment\",\"DisplayOrder\":8,\"Value\":\"PERSONAL\",\"Highlight\":0,\"Visible\":1},{\"AllowSort\":1,\"Caption\":\"Supplier\",\"DisplayOrder\":9,\"Value\":\"GOUR\",\"Highlight\":0,\"Visible\":1}],\"Unit\":\"08\"}]",
"NextLevelZoomType": 2
},
{
"RowType": 3,
"Sl": {
"Value": "3. ",
"isBold": 1,
"isItalics": 0,
"Levels": 1,
"Align": 1
},
"Particulars": {
"Value": " M",
"isBold": 0,
"isItalics": 0,
"Levels": 1,
"Align": 1
},
"Value1": {
"Value": "2",
"isBold": 0,
"isItalics": 0,
"Levels": 1,
"Align": 1
},
"Value2": {
"Value": "4455",
"isBold": 0,
"isItalics": 0,
"Levels": 1,
"Align": 1
},
"Value3": {
"Value": "15",
"isBold": 0,
"isItalics": 0,
"Levels": 1,
"Align": 1
},
"NextLevelZoomData": "[{\"UnitFields\":[{\"AllowSort\":1,\"Caption\":\"Challan No.\",\"DisplayOrder\":1,\"Value\":\"2 / 1\",\"Highlight\":0,\"Visible\":1},{\"AllowSort\":1,\"Caption\":\"No. of Days\",\"DisplayOrder\":2,\"Value\":\"153\",\"Highlight\":0,\"Visible\":1},{\"AllowSort\":1,\"Caption\":\"Bal. Qty\",\"DisplayOrder\":3,\"Value\":\"1.00 PCS\",\"Highlight\":0,\"Visible\":0},{\"AllowSort\":1,\"Caption\":\"Item\",\"DisplayOrder\":4,\"Value\":\"WAVE\",\"Highlight\":0,\"Visible\":1},{\"AllowSort\":1,\"Caption\":\"Rate\",\"DisplayOrder\":5,\"Value\":\"398.00\",\"Highlight\":0,\"Visible\":1},{\"AllowSort\":1,\"Caption\":\"Sale\",\"DisplayOrder\":6,\"Value\":\"L A\",\"Highlight\":0,\"Visible\":1},{\"AllowSort\":1,\"Caption\":\"Location\",\"DisplayOrder\":7,\"Value\":\" FLOOR\",\"Highlight\":0,\"Visible\":1},{\"AllowSort\":1,\"Caption\":\"Comment\",\"DisplayOrder\":8,\"Value\":\"SELECTION~\",\"Highlight\":0,\"Visible\":1},{\"AllowSort\":1,\"Caption\":\"Supplier\",\"DisplayOrder\":9,\"Value\":\"gtt\",\"Highlight\":0,\"Visible\":1}],\"Unit\":\"09\"},{\"UnitcodeFields\":[{\"AllowSort\":1,\"Caption\":\"Challan No.\",\"DisplayOrder\":1,\"Value\":\"1/ 1\",\"Highlight\":0,\"Visible\":1},{\"AllowSort\":1,\"Caption\":\"No. of Days\",\"DisplayOrder\":2,\"Value\":\"139\",\"Highlight\":0,\"Visible\":1},{\"AllowSort\":1,\"Caption\":\"Bal. Qty\",\"DisplayOrder\":3,\"Value\":\"1.00 PCS\",\"Highlight\":0,\"Visible\":0},{\"AllowSort\":1,\"Caption\":\"Item\",\"DisplayOrder\":4,\"Value\":\"EMjB\",\"Highlight\":0,\"Visible\":1},{\"AllowSort\":1,\"Caption\":\"Rate\",\"DisplayOrder\":5,\"Value\":\"37,590.00\",\"Highlight\":0,\"Visible\":1},{\"AllowSort\":1,\"Caption\":\"Sale\",\"DisplayOrder\":6,\"Value\":\"L A\",\"Highlight\":0,\"Visible\":1},{\"AllowSort\":1,\"Caption\":\"Location\",\"DisplayOrder\":7,\"Value\":\"MM 1\",\"Highlight\":0,\"Visible\":1},{\"AllowSort\":1,\"Caption\":\"Comment\",\"DisplayOrder\":8,\"Value\":\"PERSONAL\",\"Highlight\":0,\"Visible\":1},{\"AllowSort\":1,\"Caption\":\"Supplier\",\"DisplayOrder\":9,\"Value\":\"GOUR\",\"Highlight\":0,\"Visible\":1}],\"Unit\":\"08\"}]",
"NextLevelZoomType": 2
},
{
"RowType": 3,
"Sl": {
"Value": "4. ",
"isBold": 1,
"isItalics": 0,
"Levels": 1,
"Align": 1
},
"Particulars": {
"Value": " DESIGNS",
"isBold": 0,
"isItalics": 0,
"Levels": 1,
"Align": 1
},
"Value1": {
"Value": "1",
"isBold": 0,
"isItalics": 0,
"Levels": 1,
"Align": 1
},
"Value2": {
"Value": "2000",
"isBold": 0,
"isItalics": 0,
"Levels": 1,
"Align": 1
},
"Value3": {
"Value": "14",
"isBold": 0,
"isItalics": 0,
"Levels": 1,
"Align": 1
},
"NextLevelZoomData": "[{\"UnitFields\":[{\"AllowSort\":1,\"Caption\":\"Challan No.\",\"DisplayOrder\":1,\"Value\":\"00/ 1\",\"Highlight\":0,\"Visible\":1},{\"AllowSort\":1,\"Caption\":\"No. of Days\",\"DisplayOrder\":2,\"Value\":\"146\",\"Highlight\":0,\"Visible\":1},{\"AllowSort\":1,\"Caption\":\"Bal. Qty\",\"DisplayOrder\":3,\"Value\":\"1.00 PCS\",\"Highlight\":0,\"Visible\":0},{\"AllowSort\":1,\"Caption\":\"Item\",\"DisplayOrder\":4,\"Value\":\"EMB\",\"Highlight\":0,\"Visible\":1},{\"AllowSort\":1,\"Caption\":\"Rate\",\"DisplayOrder\":5,\"Value\":\"2000\",\"Highlight\":0,\"Visible\":1},{\"AllowSort\":1,\"Caption\":\"Sale\",\"DisplayOrder\":6,\"Value\":\"L A\",\"Highlight\":0,\"Visible\":1},{\"AllowSort\":1,\"Caption\":\"Location\",\"DisplayOrder\":7,\"Value\":\"MM 1\",\"Highlight\":0,\"Visible\":1},{\"AllowSort\":1,\"Caption\":\"Comment\",\"DisplayOrder\":8,\"Value\":\"ONE \",\"Highlight\":0,\"Visible\":1},{\"AllowSort\":1,\"Caption\":\"Supplier\",\"DisplayOrder\":9,\"Value\":\"FAIR \",\"Highlight\":0,\"Visible\":1}]}]",
"NextLevelZoomType": 2
}
],
"Status": 1,
"Msg": "Success"
}
```[Screenshot attached on debugging ][1]
[1]: https://i.stack.imgur.com/WrCOb.png