[ https://issues.apache.org/jira/browse/JOHNZON-203?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16772804#comment-16772804 ]
Romain Manni-Bucau commented on JOHNZON-203: -------------------------------------------- Hi [~elexx], this is likely the most relevant solution today. Note that JSON-B expert group is discussion that but proposed that workaround as well or directly a (de)Serializer to be lower level if the overhead is too important (depends the object graph). I did some benches on this workaround and it is quite fast since it is parsing an in memory buffer so while memory is not that much impacted it is not that bad. There is however another, probably more nasty but efficient workaround with johnzon: pass in the builder a custom JsonGeneratorFactory which will delegate to a builder factory mimicing the same API (it is not that hard since it is almost 1-1) and create a Writer which interacts with this impl, it will enable to get the produced object/array very easily and without that roundtrip. > How do I map a Java Bean to javax.json.JsonValue? > ------------------------------------------------- > > Key: JOHNZON-203 > URL: https://issues.apache.org/jira/browse/JOHNZON-203 > Project: Johnzon > Issue Type: New Feature > Affects Versions: 1.1.11 > Reporter: Alexander Falb > Priority: Major > > From what I understand {{org.apache.johnzon.mapper.Mapper}} is ment to map > Java Beans to JSON strings. > Is there a way to map from a Java Bean to a {{javax.json.JsonValue}} and from > JsonValue to a JSON string? > I would need the intermediate JsonValue based structure for further > processing before writing the final JSON string. The only way I'm curently > aware of is writing the JSON string and reading it again with > {{javax.json.Json.createReader(new StringReader(jsonString)).readObject()}}, > which is ok as a workaround, but not optimal as final solution. -- This message was sent by Atlassian JIRA (v7.6.3#76005)