Merge pull request #190 from WUMUXIAN/master

changed the unmarshalling behaviour for unmarshalling {"key": []} int…
This commit is contained in:
Vasily Romanov
2019-06-14 15:48:28 +03:00
committed by GitHub
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -1152,7 +1152,7 @@ func (r *Lexer) Interface() interface{} {
} else if r.token.delimValue == '[' {
r.consume()
var ret []interface{}
ret := []interface{}{}
for !r.IsDelim(']') {
ret = append(ret, r.Interface())
r.WantComma()
+1 -1
View File
@@ -194,7 +194,7 @@ func TestInterface(t *testing.T) {
{toParse: "5", want: float64(5)},
{toParse: `{}`, want: map[string]interface{}{}},
{toParse: `[]`, want: []interface{}(nil)},
{toParse: `[]`, want: []interface{}{}},
{toParse: `{"a": "b"}`, want: map[string]interface{}{"a": "b"}},
{toParse: `[5]`, want: []interface{}{float64(5)}},