-
Notifications
You must be signed in to change notification settings - Fork 152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RFC: partial decoding #61
Comments
I'll check out the branch, thanks for the reminder! |
@ztellman I agree that what the predicate gets passed is a little confusing, but I think for the subset of users that would find this useful, I think this looks pretty good to me, want to add some docs for it and then submit a PR (or merge it in since you have commit access)? |
any progress on this @ztellman? reinventing the Clojure wrapper in another lazy JSON parse is a pain :-) |
Well, it's been a while, but I wasn't very happy with the approach to the predicate and ultimately didn't think it was worth it. If you'd like to pick this up and create a PR against the current codebase, please feel free. |
I made a PR with that feature (as far as I understand) #134 |
I made a proof of concept for this a while back, pushed a branch, and then didn't actually explain what it is: https://github.com/dakrone/cheshire/tree/field-predicate-feature
Basically, we want to be able to use the "skip children" feature in the Jackson parser. Unfortunately, it's hard to specify where to skip without some sort of schema, but schemas (typically) would require us to enumerate all the fields we want to parse, rather than use some sort of programmatic specification.
My questionable workaround for this is a predicate function which passes in the parent and child keys as it traverses the JSON structure. So for this structure:
The predicate would first get passed
[nil "a"]
to check if{"b": 1}
should be parsed, and then["a" "b"]
to check if the1
should be parsed. This is an adequate solution, at best, but I can't think of an obviously better one.The performance gains here are at best 50%, as Jackson still needs to figure out where the children nodes end. However, 50% is still pretty good. I'd be interested to hear your thoughts.
The text was updated successfully, but these errors were encountered: