You've already forked json-iterator
mirror of
https://github.com/json-iterator/go.git
synced 2025-07-06 23:37:39 +02:00
#129 fix read map with reader, should use ReadMapCB instead of ReadObjectCB
This commit is contained in:
@ -89,7 +89,7 @@ func (any *objectLazyAny) Get(path ...interface{}) Any {
|
||||
mappedAll := map[string]Any{}
|
||||
iter := any.cfg.BorrowIterator(any.buf)
|
||||
defer any.cfg.ReturnIterator(iter)
|
||||
iter.ReadObjectCB(func(iter *Iterator, field string) bool {
|
||||
iter.ReadMapCB(func(iter *Iterator, field string) bool {
|
||||
mapped := locatePath(iter, path[1:])
|
||||
if mapped.ValueType() != Invalid {
|
||||
mappedAll[field] = mapped
|
||||
@ -108,7 +108,7 @@ func (any *objectLazyAny) Keys() []string {
|
||||
keys := []string{}
|
||||
iter := any.cfg.BorrowIterator(any.buf)
|
||||
defer any.cfg.ReturnIterator(iter)
|
||||
iter.ReadObjectCB(func(iter *Iterator, field string) bool {
|
||||
iter.ReadMapCB(func(iter *Iterator, field string) bool {
|
||||
iter.Skip()
|
||||
keys = append(keys, field)
|
||||
return true
|
||||
|
Reference in New Issue
Block a user