问题描述:

I have a json data stored in a variable.

Json Data:

var employees = {"emp":{{"firstName":"John"},{"secondName":"John"}}};

From above JSON Data, I should not have emp node. I need JSON Data as

{{"firstName":"John"},{"secondName":"John"}};

How can i remove using Javascript.

网友答案:

if your employee object is

var employees = {"emp":{"firstName":"John","secondName":"John"}}; //since your original object is not correct

simply do

employees = employees.emp;
相关阅读:
Top