Fix error when rendering to json