added a factory function to get json data