我有这个JSON数据:
var tmpStr = '[
{
"Name": "TEST",
"deviceId": "",
"CartId": "",
"timestamp": 1383197265540,
"FOOD": [],
"City": "LONDON CA"
}
]';
如何删除括号?
这是我的更多JSON文件:
[{"arrivee":false,"des":"Ceintures De Sécurité Conducteur","code":"nn","depart":true},
{"arrivee":true,"des":"Lecteur Tachygraphe","code":"nn","depart":false}
{"arrivee":false,"des":"Ceintures De Sécurités Passagères","code":"nn","depart":true},
{"arrivee":true,"des":"Climatisation","code":"nn","depart":false}]
答案 0 :(得分:2)
你不必删除括号,只需这样做,
catch
答案 1 :(得分:2)
说明强>
你不会想要的,这是一个对象的JSON数组
[ // this starts an array
{ // this starts an object
"Name": "TEST", // this is a property named 'Name'
"deviceId": "", // this is a property named 'deviceId'
"CartId": "", // this is a property named 'CartId'
"timestamp": 1383197265540, // this is a property named 'timestamp'
"FOOD": [], // this is a property named 'FOOD'
"City": "LONDON CA" // this is a property named 'City'
} // this ends an object
] // this ends an array
答案 2 :(得分:1)