Refactored JSONConnect into a class.