-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Allow custom JsonNode
implementations
#3699
Comments
@marschall Sounds like a good improvement if as you say |
There you to #3701. I have previously contributed to jackson-core and signed the CLA. See FasterXML/jackson-core#798 |
JsonNode
implementations
Thank you @marschall! Will be in 2.14.2 patch when released. |
### What changes were proposed in this pull request? This pr aims upgrade `Jackson` related dependencies to 2.14.2 ### Why are the changes needed? This version include some bug fix and improvement of databind, such as: - FasterXML/jackson-databind#3063 - FasterXML/jackson-databind#3699 The full release notes as follows: - https://github.com/FasterXML/jackson/wiki/Jackson-Release-2.14.2 ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Pass Github Actions Closes #39898 from LuciferYang/SPARK-42354. Authored-by: yangjie01 <yangjie01@baidu.com> Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
### What changes were proposed in this pull request? This pr aims upgrade `Jackson` related dependencies to 2.14.2 ### Why are the changes needed? This version include some bug fix and improvement of databind, such as: - FasterXML/jackson-databind#3063 - FasterXML/jackson-databind#3699 The full release notes as follows: - https://github.com/FasterXML/jackson/wiki/Jackson-Release-2.14.2 ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Pass Github Actions Closes #39898 from LuciferYang/SPARK-42354. Authored-by: yangjie01 <yangjie01@baidu.com> Signed-off-by: Dongjoon Hyun <dongjoon@apache.org> (cherry picked from commit eb8b97f) Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
### What changes were proposed in this pull request? This pr aims upgrade `Jackson` related dependencies to 2.14.2 ### Why are the changes needed? This version include some bug fix and improvement of databind, such as: - FasterXML/jackson-databind#3063 - FasterXML/jackson-databind#3699 The full release notes as follows: - https://github.com/FasterXML/jackson/wiki/Jackson-Release-2.14.2 ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Pass Github Actions Closes apache#39898 from LuciferYang/SPARK-42354. Authored-by: yangjie01 <yangjie01@baidu.com> Signed-off-by: Dongjoon Hyun <dongjoon@apache.org> (cherry picked from commit eb8b97f) Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
Is your feature request related to a problem? Please describe.
com.fasterxml.jackson.databind.ObjectReader#readValue(JsonNode)
currently only works withJsonNode
implementations from thejackson-databind
module. It does not work with customJsonNode
implementations. We have a use case where we would like to use customJsonNode
implementations.Describe the solution you'd like
com.fasterxml.jackson.databind.ObjectReader#readValue(JsonNode)
should work with anyJsonNode
implementation. The reason this currently does not work is becauseObjectCursor
currently casts toObjectNode
jackson-databind/src/main/java/com/fasterxml/jackson/databind/node/NodeCursor.java
Line 198 in 9e3a311
There is no need for this as
#fields()
is defined onJsonNode
.ArrayCursor
for example does not cast toArrayNode
and just callsJsonNode#elements()
.Usage example
Additional context
On our project we settled on Jackson and jackson-databind for our JSON parsing and object mapping needs. So far this has worked well for us. We also store JSON in the database as LOBs. Our database vendor has introduced a native JSON datatype. Part of this is a custom binary format to send JSON preparsed over the wire to the driver. The driver can use this format directly without the need to serialize to text first. The driver exposes this as
javax.json.JsonObject
objects to our code.We are experimenting with adapting
javax.json.JsonObject
tocom.fasterxml.jackson.databind.JsonNode
. This would give us the efficiency of being able to use the driver to parse the database internal format while still being able to use jackson-databind for the mapping.Simply removing the cast seems to do the trick. An additional check could be introduced, on the other hand
ArrayCursor
has no such check.marschall@1209c84
The text was updated successfully, but these errors were encountered: