Modify posts controller to render JSON