Skip to content

Commit 061543f

Browse files
committed
do not pipe non-json data through json.dumps
1 parent eb3b0a7 commit 061543f

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

nbconvert/preprocessors/extractoutput.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ class ExtractOutputPreprocessor(Preprocessor):
4343
).tag(config=True)
4444

4545
extract_output_types = Set(
46-
{'image/png', 'image/jpeg', 'image/svg+xml', 'application/pdf'}
46+
{'image/png', 'image/jpeg', 'image/svg+xml',
47+
'application/pdf', 'application/json'}
4748
).tag(config=True)
4849

4950
def preprocess_cell(self, cell, resources, cell_index):
@@ -80,10 +81,7 @@ def preprocess_cell(self, cell, resources, cell_index):
8081
if mime_type in out.data:
8182
data = out.data[mime_type]
8283

83-
if (
84-
not isinstance(data, text_type)
85-
or mime_type == 'application/json'
86-
):
84+
if mime_type == 'application/json':
8785
# Data is either JSON-like and was parsed into a Python
8886
# object according to the spec, or data is for sure
8987
# JSON. In the latter case we want to go extra sure that

0 commit comments

Comments
 (0)