1
0
mirror of https://github.com/json-iterator/go.git synced 2025-07-03 23:30:41 +02:00

#133 fix empty struct skip; fix ] as empty array

This commit is contained in:
Tao Wen
2017-07-17 09:09:00 +08:00
parent 0d604da7d7
commit 9b3ec40fd9
10 changed files with 55 additions and 40 deletions

View File

@ -34,10 +34,16 @@ func (iter *Iterator) ReadArrayCB(callback func(*Iterator) bool) (ret bool) {
if !callback(iter) {
return false
}
for iter.nextToken() == ',' {
c = iter.nextToken()
for c == ',' {
if !callback(iter) {
return false
}
c = iter.nextToken()
}
if c != ']' {
iter.ReportError("ReadArrayCB", "expect ] in the end")
return false
}
return true
}