Preparing controller to return JSON