createJSON in functions