Repository navigation
Closed
Description
Lines 943 to 957 in bf1c66b
| if e != nil { | |
| return offset, e | |
| } | |
| if o == 0 { | |
| break | |
| } | |
| if t != NotExist { | |
| cb(v, t, offset+o-len(v), e) | |
| } | |
| if e != nil { | |
| break | |
| } |
how to indicate that cb return an error for ArrayEach, like ObjectEach do.
Lines 1053 to 1060 in bf1c66b
| // Step 3: find the associated value, then invoke the callback | |
| if value, valueType, off, err := Get(data[offset:]); err != nil { | |
| return err | |
| } else if err := callback(key, value, valueType, offset+off); err != nil { // Invoke the callback here! | |
| return err | |
| } else { | |
| offset += off | |
| } |
Reacted by Leonard Shi, Charles Vejnar, Rikke Bendlin Gammelmark, Alekséi Naidénov, grind-t, Sergey Dobrodey, Gabe Cook, Alejandro Cruz and Muhammad Yahya Muhaimin
Metadata
Metadata
Assignees
Labels
No labels
Activity
stephane-moreau commentedon Oct 13, 2020
I had the same issue, willing to fail fast on some JSON parsing, I've put together a PR #214 feel free to comment and review
v1.4.0: ArrayEachErr, Escape/SetString, wildcards, JSONPath, GetArray…
buger commentedon Jul 28, 2026
Implemented in v1.4.0 —
ArrayEachErr(data, func(value []byte, vt ValueType, offset int, err error) error { return myErr }, keys...). See: https://github.com/buger/jsonparser/releases/tag/v1.4.0