Skip to content

Saving large Jupyter notebooks fails due to the string length restriction of JSON.stringify #227997

Closed
@DonJayamanne

Description

@DonJayamanne

Given we're serializing a lot of cells, we can easily serialize the cells one by one and then construct the bytes from that, instead of building a string.

I.e. notebook = {cells: [.....], metadata: {...}}

pseudo code:
json = [TextEncoder.encode({), ...notebook.cells.map(cell => TextEncoder.encode(JSON.stringify(cell)))];

Given that we know the indent level, its easy to construct the JSON string in pieces of bytes.

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable bugnotebook-ipynbpapercut 🩸A particularly annoying issue impacting someone on the team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions