diff --git a/private/presenter.nim b/private/presenter.nim index 1a709df..1a3c06a 100644 --- a/private/presenter.nim +++ b/private/presenter.nim @@ -253,7 +253,7 @@ proc present*(s: YamlStream, target: Stream, tagLib: YamlTagLibrary, nextState = if length <= 60: dFlowSequenceStart else: dBlockSequenceItem of ypsJson: - if levels[levels.high] in + if levels.len > 0 and levels[levels.high] in [dFlowImplicitMapStart, dFlowImplicitMapValue]: raise newException(YamlPresenterJsonError, "Cannot have sequence as map key in JSON output!") @@ -457,4 +457,4 @@ proc transform*(input: Stream, output: Stream, style: YamlPresentationStyle, tagLib = extendedTagLibrary() parser = newParser(tagLib) present(parser.parse(input), output, tagLib, style, - indentationStep) \ No newline at end of file + indentationStep)