0

Is there a way to programatically deserialize JSON to blaze-persistence entity view? When I'm using standard jackson object mapper, and trying to do

mapper.readValue(serializedJSON, EntityViewImpl.class);

where serializedJSON is string representation (serialized from the same class of entity view), and EntityViewImpl.class is code-generated implementation of entity view interface, I'm getting an exception:

com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of (although at least one Creator exists): cannot deserialize from Object value (no delegate or property based Creator) at [Source: (String) "{JSON representation of EntityView}"; line: 1, column: 2] .

Same JSON correctly deserializes into entity that was basis for used entity view.

I noticed that there is a custom deserialization functionality as part of the blaze-persistance, although was not able to find any related documentation.

So any answer, eighther with standard jackson mapper or with custom blaze-persistence functionality would work for me.

1 Answers1

0

You can use the Jackson integration which allows you to deserialize creatable/updatable entity views. There are integrations for JAX-RS and Spring WebMvc/WebFlux and even GraphQL though, so chances are, you don't have to do this plumbing yourself. If you share some more details like the entity view and the are where you want to do deserialization, I can give you a more extensive answer.

Christian Beikov
  • 15,141
  • 2
  • 32
  • 58