Refactored JSON functions into their own class; wrote base class for API endpoints.