Using JavaScript what's the quickest way to recursively remove properties and values from an object?

前端 未结 7 937
攒了一身酷
攒了一身酷 2020-12-03 21:03

I need to find the fastest way to remove all $meta properties and their values from an object, for example:

{
  \"part_one\": {
    \"name\": \"         


        
7条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-03 21:38

    As @floor commented above:

    JSON.parse(JSON.stringify(obj, (k,v) => (k === '$meta')? undefined : v))

提交回复
热议问题