this test fails because the length of value.Array() is two instead of the expected 4.
When the length was 1, the length of Array() was 1
When the length was 2, the length of Array() was 1
When the length was 3, the length of Array() was 1
When the length was 4, the length of Array() was 2
When the length was 5, the length of Array() was 3
When the length was 6, the length of Array() was 4
Might this be in arrayOrMap(), where it treats every other element as a key?
func TestArray(t *testing.T) {
parsed := gjson.Get("{\"foo\" : [\"a\", Null, False, 1]}", "foo")
assert.Truef(t, parsed.IsArray(), "the array element %v is not reporting IsArray()", parsed)
assert.Equal(t, 4, len(parsed.Array()))
}
this test fails because the length of
value.Array()
is two instead of the expected 4.When the length was 1, the length of Array() was 1 When the length was 2, the length of Array() was 1 When the length was 3, the length of Array() was 1 When the length was 4, the length of Array() was 2 When the length was 5, the length of Array() was 3 When the length was 6, the length of Array() was 4
Might this be in
arrayOrMap()
, where it treats every other element as a key?Cheers