Class JacksonGraphQLJsonSerializer

java.lang.Object
io.micronaut.configuration.graphql.JacksonGraphQLJsonSerializer
All Implemented Interfaces:
GraphQLJsonSerializer

@Singleton public class JacksonGraphQLJsonSerializer extends Object implements GraphQLJsonSerializer
The Jackson implementation for serializing and deserializing GraphQL objects.
Since:
1.0
Author:
Marcel Overdijk
  • Constructor Details

    • JacksonGraphQLJsonSerializer

      public JacksonGraphQLJsonSerializer(io.micronaut.json.JsonMapper jsonMapper)
      Default constructor.
      Parameters:
      jsonMapper - the JsonMapper instance
      Since:
      3.1.0
  • Method Details

    • serialize

      public String serialize(Object object)
      Serializes the given object to a json String.
      Specified by:
      serialize in interface GraphQLJsonSerializer
      Parameters:
      object - the object to serialize
      Returns:
      the json string
    • deserialize

      public <T> T deserialize(String json, Class<T> requiredType)
      Deserializes the given json String to an object of the required type.
      Specified by:
      deserialize in interface GraphQLJsonSerializer
      Type Parameters:
      T - the required generic type
      Parameters:
      json - the json string
      requiredType - the required type
      Returns:
      the object