从json对象中删除项目

时间:2013-08-13 18:35:34

标签: json nsjsonserialization

我有一个像这样的json对象

[[{"class":"core.classes.lab.LabOrder","dueDate":1376073000000,"orderCreateDate":1376073000000,"orderCreateUser":1,"orderLastUpdate":1376073000000,"orderLastUpdateUser":1,"orderLocation":"private","orderPriority":2,"orderRemarks":null,"orderStatus":"pending","order_ID":1,"testID":{"LOINCCode":"1234","category":"Blood","class":"core.classes.lab.TestDescription","isSpecimenAvailable":true,"testDescription":"Collect Blood Specimen and get the details ","testID":1,"testName":"Blood Sugar","testProcedure":"Collect Blood"}},{"LOINCCode":"1234","category":"Blood","class":"core.classes.lab.TestDescription","isSpecimenAvailable":true,"testDescription":"Collect Blood Specimen and get the details ","testID":1,"testName":"Blood Sugar","testProcedure":"Collect Blood"}]]

我想从这个json中删除下面的部分

{"LOINCCode":"1234","category":"Blood","class":"core.classes.lab.TestDescription","isSpecimenAvailable":true,"testDescription":"Collect Blood Specimen and get the details ","testID":1,"testName":"Blood Sugar","testProcedure":"Collect Blood"}

有一种简单的方法可以做到这一点

1 个答案:

答案 0 :(得分:1)

var jsonObject = {   “class”:“core.classes.lab.LabOrder”,   “dueDate”:1376073000000,   “orderCreateDate”:1376073000000,   “orderCreateUser”:1,   “orderLastUpdate”:1376073000000,   “orderLastUpdateUser”:1,   “orderLocation”:“私人”,   “orderPriority”:2,   “orderRemarks”:null,   “订单状态:待处理”,   “order_ID”:1,   “testID”:{     “LOINCCode”:“1234”,     “类别”:“血液”,     “class”:“core.classes.lab.TestDescription”,     “isSpecimenAvailable”:是的,     “testDescription”:“收集血液样本并获取详细信息”,     “testID”:1,     “testName”:“血糖”,     “testProcedure”:“收血”   } }

删除 jsonObject.testID