Move function to directive.  Add test JSON file.