@@ -1319,14 +1319,16 @@ convertWithOpts opts args = do
13191319 either (return . Left) (\s -> fmap (,mempty) <$> r readerOpts s) doc
13201320 ByteStringReader r -> readFiles sources' >>= r readerOpts
13211321
1322− -- We parse first if fileScope is set OR if the reader is a
1323− -- BSReader. So, if it's a StringReader AND not fileScope, we
1324− -- don't.
1322+ -- We parse first if (1) fileScope is set, (2), it's a binary
1323+ -- reader, or (3) we're reading JSON. This is easier to do of an AND
1324+ -- of negatives as opposed to an OR of positives, so we do default
1325+ -- parsing if it's a StringReader AND (fileScope is set AND it's not
1326+ -- a JSON reader).
13251327 (doc, media) <- case reader of
1326− (StringReader _) | not fileScope -> sourceToDoc sources
1327− _ -> do
1328− pairs <- mapM (\s -> sourceToDoc [s]) sources
1329− return (mconcat $ map fst pairs, mconcat $ map snd pairs)
1328+ (StringReader _) | not fileScope && readerName' /= "json" ->
1329+ sourceToDoc sources
1330+ _ -> do pairs <- mapM (\s -> sourceToDoc [s]) sources
1331+ return (mconcat $ map fst pairs, mconcat $ map snd pairs)
13301332
13311333 let writerOptions = def { writerStandalone = standalone',
13321334 writerTemplate = templ,