I need to filter JSON objects' properties and values based on a dynamic template (for security reasons). It is like viewing the JSON objects through a mask that is known only at run time.

Say I have this JSON object:

```
{ "id": "1",
  "foo": [ "1", "2", "3" ],
  "bar": [ "a", "b", "c"],
  "fuzz": [ "y", "x" ]
}

```

And this template:

```
{ "id": "",
  "fuzz": [ "y", "z"],
  "foo": ""
}

```

Now I want to have the following result (applying the template onto the object):

```
{ "id": "1",
  "fuzz": [ "y" ],
  "foo": [ "1", "2", "3" ]
}

```

What are the best solutions to filter

1. Only the properties (leaving values untouched)?
2. The properties and the values (like in the example above)?

Notes:

* The ordering of properties and values may be different between the template and the objects
* My environment is NodeJS + BackboneJS
* A have a lot of objects to filter, so performance matters