0

My project uses JSON-B with JAX-RS. The framework I am using is Quarkus and use Java 11. I tried to upgrade to Java 16 and use Java Records. It seems that JSON-B and Records does not work nicely.

I have tried @JsonbCreator. But this annotation only works with a single constructor.

I have also tried to use the Apache Johnzon as shown here (https://adambien.blog/roller/abien/entry/java_14_java_record_json). But Quarkus Resteasy does not have a Johnzon binding.

Is there a solution that would allow me to switch to Java Records?

Thanks

sudhir shakya
  • 827
  • 1
  • 9
  • 21

1 Answers1

3

Quarkus uses Eclipse Yasson as its JSON-B implementation and currently Yasson does not support Records. However that will likely change soon, see this issue.

If you are willing to move away from JSON-B, you can use Jackson with Quarkus and have Records support as Jackson supports them since version 2.12

geoand
  • 60,071
  • 24
  • 172
  • 190
  • I am using Quarkus 2.13.3, which does have a Jackson which is recent enough, but it fails to work! Anyone know why? – Mambazo Nov 16 '22 at 01:58