From 280f0d6ce2c4e71de96d9f3ea8e4c18c596a8f97 Mon Sep 17 00:00:00 2001 From: Felix Krause Date: Wed, 8 Jun 2016 20:07:29 +0200 Subject: [PATCH] Check for multiple documents when dumping JSON --- private/presenter.nim | 3 +++ 1 file changed, 3 insertions(+) diff --git a/private/presenter.nim b/private/presenter.nim index c084015..072ff04 100644 --- a/private/presenter.nim +++ b/private/presenter.nim @@ -580,6 +580,9 @@ proc present*(s: var YamlStream, target: Stream, tagLib: TagLibrary, indentation -= options.indentationStep of yamlEndDoc: if finished(s): break + if options.style == psJson: + raise newException(YamlPresenterJsonError, + "Cannot output more than one document in JSON style") safeWrite("..." & newline) proc transform*(input: Stream, output: Stream,