If you run, e.g., cat Untitled.ipynb | cargo run -p ruff_cli -- check --stdin-filename Untitled.ipynb -n --fix, then the content we write to stdout is the fixed source code. Writing this back to the notebook will leave you with an invalid notebook! Instead, we need to write back the entire JSON structure, including the fixed content.