Yes, pyramidhook might be a better place. I just put it here to have it close to where the error-render logic was before (in _JSONError).