如何发送多个数组与对象数组发送到android

时间:2019-02-13 06:03:28

标签: java android json arraylist

我正在使用此代码,这种格式显示无效的JSON,请告诉我任何android代码

 Format:-->
    {
     "supplyType":"O",
     "subSupplyType":"1",
     "subSupplyDesc":"TESTDESCRIPTION",
     "docType": "BIL", 
     "docNo": "18-86"
        "itemList": [{
      "productName": "Wheat",
      "productDesc": "Wheat",
      "hsnCode": 84,
      "quantity": 10,
      "qtyUnit": "BOX",
      "cgstRate": 0,
      "sgstRate": 0,
      "igstRate": 12,
      "cessRate": 0,
      "cessAdvol": 0,
      "taxableAmount":5609889
     },
     {
      "productName": "Wheat",
      "productDesc": "Wheat",
      "hsnCode": 84,
      "quantity": 10,
      "qtyUnit": "BOX",
      "cgstRate": 0,
      "sgstRate": 0,
      "igstRate": 12,
      "cessRate": 0,
      "cessAdvol": 0,
      "taxableAmount":5609889
     }]
    }

2 个答案:

答案 0 :(得分:0)

检查此-

 {
     "supplyType":"O",
     "subSupplyType":"1",
     "subSupplyDesc":"TESTDESCRIPTION",
     "docType": "BIL", 
     "docNo": "18-86",
        "itemList": [
          {
      "productName": "Wheat",
      "productDesc": "Wheat",
      "hsnCode": 84,
      "quantity": 10,
      "qtyUnit": "BOX",
      "cgstRate": 0,
      "sgstRate": 0,
      "igstRate": 12,
      "cessRate": 0,
      "cessAdvol": 0,
      "taxableAmount":5609889
     },
     {
      "productName": "Wheat",
      "productDesc": "Wheat",
      "hsnCode": 84,
      "quantity": 10,
      "qtyUnit": "BOX",
      "cgstRate": 0,
      "sgstRate": 0,
      "igstRate": 12,
      "cessRate": 0,
      "cessAdvol": 0,
      "taxableAmount":5609889
     }
     ]
    }

答案 1 :(得分:0)

检查一下,您错过了逗号。使用JSON Viewer网站检查错误。

{
supplyType: "O",
subSupplyType: "1",
subSupplyDesc: "TESTDESCRIPTION",
docType: "BIL",
docNo: "18-86",
itemList: [
{
  productName: "Wheat",
  productDesc: "Wheat",
  hsnCode: 84,
  quantity: 10,
  qtyUnit: "BOX",
  cgstRate: 0,
  sgstRate: 0,
  igstRate: 12,
  cessRate: 0,
  cessAdvol: 0,
  taxableAmount: 5609889
},
{
  productName: "Wheat",
  productDesc: "Wheat",
  hsnCode: 84,
  quantity: 10,
  qtyUnit: "BOX",
  cgstRate: 0,
  sgstRate: 0,
  igstRate: 12,
  cessRate: 0,
  cessAdvol: 0,
  taxableAmount: 5609889
}
]
}