我是json的新手,不知道问题标题是否正确
我在obj中跟踪了这个语句'obj = ko.toJSON(viewModel)'中的json; viewmodel是一个淘汰视图。
{
"activeColumns": [
{
"property": "delete",
"display": "Delete",
"checked": true,
"readonly": true
},
{
"property": "id",
"display": "ID",
"checked": false,
"readonly": true
},
{
"property": "name",
"display": "Name",
"checked": false,
"readonly": false
},
{
"property": "age",
"display": "Age",
"checked": false,
"readonly": false
}
],
"rows": [
{
"selectedFruits": [],
"id": 1,
"name": "Bob",
"age": 44
},
{
"selectedFruits": [],
"id": 2,
"name": "Ted",
"age": 22
},
{
"selectedFruits": [],
"id": 3,
"name": "Jane",
"age": 55
},
{
"selectedFruits": [],
"id": 4,
"name": "Sue",
"age": 11
}
],
"newName": "",
"lastSavedJson": "",
"newAge": "",
"newAttribute": "",
"males": 10,
"females": 90,
"val": 50,
"selectedValue": "select",
"selectedCategory": "select",
"availablecategory": [
"select",
"functional",
"non-functional",
"technical"
],
"tshirtoptions": [
"select",
"S",
"M",
"L",
"XL",
"XXL"
],
"availableparametertype": [
"select",
"range",
"numeric",
"percentage",
"t-shirt"
]
}
我正在使用obj.activeColumns()[0]访问第一个数组,但它显示未捕获的类型错误。如何访问不同的对象数组及其属性,然后再如何删除特定对象。感谢...