javascript - Cut data from array of JSON objects -



javascript - Cut data from array of JSON objects -

i have array of json objects this:

[ { id: 841, when: 'date', who: 'asd', what: 'what', key1 : 'a key', key2 : 'a key' _id: 544034ab914ae3b9270545c1, __v: 0 }, { id: 841, when: 'date', who: 'asd', what: 'what', key1 : 'a key', key2 : 'a key' _id: 544034ab914ae3b9270545c1, __v: 0 } ]

i want cutting key1 , key2from objects , want see this:

[ { id: 841, when: 'date', who: 'asd', what: 'what', _id: 544034ab914ae3b9270545c1, __v: 0 }, { id: 841, when: 'date', who: 'asd', what: 'what', _id: 544034ab914ae3b9270545c1, __v: 0 } ]

how can cutting keys , values?

my method not working. (pseudo) :

var new_array old_array.length delete old_array[i].key1 delete old_array[i].key2 new_array.push(old_array[i])

yourarray = yourarray.map(function(current, index, arr){ delete current.key1; delete current.key2; homecoming current; });

that should wish ;-)

hope helps, jan

javascript arrays json

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -