Repository navigation
Unify names and declarations #66
Description
Activity
The difference between
ArrayEachandObjectEachis an artifact of this library's API evolution over time, unfortunately.EachKeyactually does something fundamentally different from the other two (it's basically a multi-key version ofGet). It is named too similarly to the others for my taste, though. Maybe we can turn this issue into a list of suggestions for "jsonparser 2.0" to do breaking API changes all at once?Reacted by RamiSounds like a plan, but lets get all functionality on this version first so we know where we're going in 2.0
@daboyuka @rami-dabain sorry for the delay. I'm obviously very busy, and if some of you want to prepare list of the changes which you want to see in next version, I'm glad for any help :)
@buger Same goes for me, I'll try to do it during my next vacation.
The last argument to the ArrayEach callback is an error which is always guaranteed to be nil since a5d5436. Maybe the arg should be renamed '_' with a small function documentation change saying the parameter is no longer of use and will be nil. If and when there is a breaking change to the API, this parameter could be dropped and a return value of error could be use to short circuit the iteration.
- added a commit that references this issue
on Jul 28, 2026 Implemented in v1.5.0 — canonical
EachXxxnames added as aliases:EachArray,EachObject,EachArrayErr,EachArrayWildcard. The oldXxxEachnames are kept for backward compatibility. EachKey/EachKeyErr/EachKeyWildcard already matched the pattern. See: https://github.com/buger/jsonparser/releases
Currently we have :
ArrayEach and ObjectEach almost do same function, and have same parameters, but the function declarations/def are bit different
Suggest overriding EachKey with KeyEach (or override to EachObject and EachArray whatever sounds more logial) and make the function declaration/parameters as close as possible
Would be greate to have this marked as to-do, so whenever I have time i'll get back to it