Skip to content
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

Way to map directly to/from JsonGenerator and JsonParser #122

Open
jjspiegel opened this issue Feb 27, 2019 · 5 comments
Open

Way to map directly to/from JsonGenerator and JsonParser #122

jjspiegel opened this issue Feb 27, 2019 · 5 comments
Labels
enhancement New feature or request

Comments

@jjspiegel
Copy link

Some data binding frameworks provide a way to do mappings to/from parsers and generator.

JAXB:

https://docs.oracle.com/javase/8/docs/api/javax/xml/bind/JAXB.html#unmarshal-javax.xml.transform.Source-java.lang.Class-
https://docs.oracle.com/javase/8/docs/api/javax/xml/bind/JAXB.html#marshal-java.lang.Object-javax.xml.transform.Result-

(see StAXResult and StAXSource)

Jackson:

https://fasterxml.github.io/jackson-databind/javadoc/2.7/com/fasterxml/jackson/databind/ObjectMapper.html#writeValue(com.fasterxml.jackson.core.JsonGenerator,%20java.lang.Object)
https://fasterxml.github.io/jackson-databind/javadoc/2.7/com/fasterxml/jackson/databind/ObjectMapper.html#readValues(com.fasterxml.jackson.core.JsonParser,%20java.lang.Class)

This is a useful feature as it allows a user to leverage the mapping rules without requiring a serialization format (JSON text or some other format). Also some implementations might only implement parser/generator and not implement JsonProvider.

Could we add to/from JSON methods for JsonParser and JsonGenerator?

See also: eclipse-ee4j/yasson#245

@aguibert aguibert added the enhancement New feature or request label Jul 22, 2019
@aguibert aguibert added the duplicate This issue or pull request already exists label Jul 29, 2019
@aguibert
Copy link
Contributor

Closing this item as a duplicate of #111

@jjspiegel
Copy link
Author

Based on the bug descriptions, these issues do not appear to be duplicates. Can you give an explanation or reopen this issue?

@aguibert aguibert removed the duplicate This issue or pull request already exists label Jul 30, 2019
@aguibert
Copy link
Contributor

I had closed it as a duplicate because #111 refers to a similar type of bridge methods w/ JSON-P. I figured to/fromJsonStructure would be sufficient for users to bridge with JSON-P.

I suppose bridge methods with JsonGenerator/Parser would also have value, so I can re-open this issue.

@emattheis
Copy link

See #224 for some discussion about why bridging to/from JsonStructure is insufficient. I missed this issue when I filed the new one, but @jjspiegel's original request is what I'm looking for as well.

@emattheis
Copy link

Also, note that some work is likely necessary in JSON-P to make this work like JAXB or Jackson: jakartaee/jsonp-api#233

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants