Closed kalgon closed 3 years ago
Hi,
I get where you are coming from but have to admit that I'm mixed about this one because current API enables to use JsonReader/JsonWriter and does not require JsonGenerator/JsonParser to be used - which is very good and enables/simplifies the adoption as a portable API whereas otherwise the entry cost will increase a lot and the API will become quickly closer to an implementation (or be as rigid as an impl to be fair).
Think a workaround, as of today, is to inject the JsonProvider in JsonbBuilder (https://github.com/eclipse-ee4j/jsonb-api/blob/master/api/src/main/java/jakarta/json/bind/JsonbBuilder.java#L58). You will not get any guarantee about the usage of the API but it will enable you to wrap them all and reach your goal more portably.
OK, I'll wrap the JsonProvider
instead. Thanks!
I was writing an implementation of
JsonGenerator
which prevents writing empty objects (like a non-null bean whose properties are all null and ends up being written as{}
) and noticed that I could not give myJsonGenerator
toJsonb.toJson()
which only takesWriter
orOutputStream
. So could it be possible to addvoid toJson(Object, JsonGenerator)
andvoid toJson(Object, Type, JsonGenerator)
toJsonb
? For the sake of symmetry, consider adding<T> T fromJson(JsonParser, Class<T>)
and<T> T fromJson(JsonParser, Type)
too...