diff --git a/decode_test.go b/decode_test.go index 6b99879b..8ed7652f 100644 --- a/decode_test.go +++ b/decode_test.go @@ -647,6 +647,23 @@ merge: "v: [A,1,C]", map[string]interface{}{"v": []interface{}{"A", 1, "C"}}, }, + { + "v: [a: b, c: d]", + map[string]any{"v": []any{ + map[string]any{"a": "b"}, + map[string]any{"c": "d"}, + }}, + }, + { + "v: [{a: b}, {c: d, e: f}]", + map[string]any{"v": []any{ + map[string]any{"a": "b"}, + map[string]any{ + "c": "d", + "e": "f", + }, + }}, + }, // Block sequence { diff --git a/parser/parser.go b/parser/parser.go index a3918fd7..49334a2a 100644 --- a/parser/parser.go +++ b/parser/parser.go @@ -533,7 +533,7 @@ func (p *parser) validateMapKeyValueNextToken(ctx *context, keyTk, tk *Token) er if tk.Column() <= keyTk.Column() { return nil } - if ctx.isFlow && tk.Type() == token.CollectEntryType { + if ctx.isFlow && (tk.Type() == token.CollectEntryType || tk.Type() == token.SequenceEndType) { return nil } // a: b