Javascript functions to filter a json object.