Use JSON output object for json mimetype (#197871)

This commit is contained in:
Don Jayamanne
2023-11-10 11:13:42 +11:00
committed by GitHub
parent 9891465832
commit cb6c07d46d

View File

@@ -139,6 +139,8 @@ function convertJupyterOutputToBuffer(mime: string, value: unknown): NotebookCel
}
} else if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
return NotebookCellOutputItem.text(JSON.stringify(value), mime);
} else if (mime === 'application/json') {
return NotebookCellOutputItem.json(value, mime);
} else {
// For everything else, treat the data as strings (or multi-line strings).
value = Array.isArray(value) ? concatMultilineString(value) : value;