added json reading in the controller.