diff --git a/json/parser/parser.go b/json/parser/parser.go index 125a5f072..f1ac3baf9 100644 --- a/json/parser/parser.go +++ b/json/parser/parser.go @@ -219,7 +219,7 @@ func (p *Parser) listType() (*ast.ListType, error) { for { tok := p.scan() switch tok.Type { - case token.NUMBER, token.FLOAT, token.STRING: + case token.NUMBER, token.FLOAT, token.STRING, token.BOOL: node, err := p.literalType() if err != nil { return nil, err @@ -235,8 +235,6 @@ func (p *Parser) listType() (*ast.ListType, error) { } l.Add(node) - case token.BOOL: - // TODO(arslan) should we support? not supported by HCL yet case token.LBRACK: // TODO(arslan) should we support nested lists? Even though it's // written in README of HCL, it's not a part of the grammar diff --git a/json/parser/parser_test.go b/json/parser/parser_test.go index e0cebf50a..49d36e3cb 100644 --- a/json/parser/parser_test.go +++ b/json/parser/parser_test.go @@ -70,6 +70,10 @@ func TestListType(t *testing.T) { `"foo": ["123", {}]`, []token.Type{token.STRING, token.LBRACE}, }, + { + `"foo": [true, false]`, + []token.Type{token.BOOL, token.BOOL}, + }, } for _, l := range literals {