[Solved] Filtering JSON Data based on the Values in the Array


You could map the values of the given keys for a new object.

var keys = ["c", "f"],
    data = [{ a: 1, b: 2, c: 3, d: 4, e: 5, f: 6 }, { a: 2, b: 4, c: 6, d: 8, e: 10, f: 12 }],
    filtered = data.map(o => Object.assign(...keys.map(k => ({ [k]: o[k] }))));

console.log(filtered);

solved Filtering JSON Data based on the Values in the Array