我有json字符串,但无法解析。谁能帮忙。提前谢谢。
{
[
{"transaction_name" : "total_fare", "unit" : "Rs", "label" : "Bill Amount", "value" : 250, "additional_details" : "4 Rides"},
{"transaction_name" : "incentives", "label" : "Incentives", "value" : 50, "additional_details" : ""},
{"transaction_name" : "fees", "label" : "Fees", "value" : -20, "additional_details" : "Rs 5 on each ride"},
{"transaction_name" : "device_deduction", "label" : "Device Deduction", "value" : -20, "additional_details" : ""},
{"transaction_name" : "tax", "label" : "Device Deduction", "value" : -20, "additional_details" : ""},
{"transaction_name" : "device_deduction", "label" : "Device Deduction", "value" : -20, "additional_details" : ""}]
],
"footer" :
{
"transaction_name" : "total_earning_net", "label" : "Total Earnings", "value" : 200,
"additional_details" : "Rounding Off"
}
}
答案 0 :(得分:0)
您的JSON本身是错误的,请尝试为您的JSONArray提供密钥,
{
"data": [{
"transaction_name": "total_fare",
"unit": "Rs",
"label": "Bill Amount",
"value": 250,
"additional_details": "4 Rides"
}, {
"transaction_name": "incentives",
"label": "Incentives",
"value": 50,
"additional_details": ""
}, {
"transaction_name": "fees",
"label": "Fees",
"value": -20,
"additional_details": "Rs 5 on each ride"
}, {
"transaction_name": "device_deduction",
"label": "Device Deduction",
"value": -20,
"additional_details": ""
}, {
"transaction_name": "tax",
"label": "Device Deduction",
"value": -20,
"additional_details": ""
}, {
"transaction_name": "device_deduction",
"label": "Device Deduction",
"value": -20,
"additional_details": ""
}],
"footer": {
"transaction_name": "total_earning_net",
"label": "Total Earnings",
"value": 200,
"additional_details": "Rounding Off"
}
}