我有一个存储在变量中的json数据。
Json数据:
var employees = {"emp":{{"firstName":"John"},{"secondName":"John"}}};
从JSON Data上面,我不应该有emp节点。我需要JSON数据
{{"firstName":"John"},{"secondName":"John"}};
如何使用Javascript删除。
答案 0 :(得分:3)
如果您的employee
对象是
var employees = {"emp":{"firstName":"John","secondName":"John"}}; //since your original object is not correct
简单地做
employees = employees.emp;