Skip to content

Unify names and declarations #66

Description

@rami-dabain

Currently we have :

EachKey
ArrayEach
ObjectEach

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

Activity

  1. daboyuka commented on Aug 26, 2016

    @daboyuka
    Contributor

    The difference between ArrayEach and ObjectEach is an artifact of this library's API evolution over time, unfortunately.

    EachKey actually does something fundamentally different from the other two (it's basically a multi-key version of Get). 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?

  2. rami-dabain commented on Aug 29, 2016

    @rami-dabain
    Author

    Sounds like a plan, but lets get all functionality on this version first so we know where we're going in 2.0

  3. buger commented on Nov 6, 2016

    @buger
    Owner

    @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 :)

  4. rami-dabain commented on Nov 10, 2016

    @rami-dabain
    Author

    @buger Same goes for me, I'll try to do it during my next vacation.

  5. FrankReh commented on May 22, 2019

    @FrankReh

    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.

  6. buger commented on Jul 28, 2026

    @buger
    Owner

    Implemented in v1.5.0 — canonical EachXxx names added as aliases: EachArray, EachObject, EachArrayErr, EachArrayWildcard. The old XxxEach names are kept for backward compatibility. EachKey/EachKeyErr/EachKeyWildcard already matched the pattern. See: https://github.com/buger/jsonparser/releases

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions