Package 

Class JSONKtor

  • All Implemented Interfaces:
    io.ktor.serialization.ContentConverter

    
    public final class JSONKtor
     implements ContentConverter
                        

    JSON ContentConverter for Ktor. Converts to/from JSON using the kjson library.

    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
      JSONKtor(ContentType contentType, JSONConfig config)
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      OutgoingContent serializeNullable(ContentType contentType, Charset charset, TypeInfo typeInfo, Object value) Serialize output object to an OutgoingContent.
      Object deserialize(Charset charset, TypeInfo typeInfo, ByteReadChannel content) Deserialize JSON input to a specified type.
      • Methods inherited from class io.ktor.serialization.ContentConverter

        serialize
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • JSONKtor

        JSONKtor(ContentType contentType, JSONConfig config)
    • Method Detail

      • serializeNullable

         OutgoingContent serializeNullable(ContentType contentType, Charset charset, TypeInfo typeInfo, Object value)

        Serialize output object to an OutgoingContent. Creates a WriteChannelContent (streaming) if the streamOutput flag is set in the JSONConfig, otherwise creates a TextContent (non-streaming).

      • deserialize

         Object deserialize(Charset charset, TypeInfo typeInfo, ByteReadChannel content)

        Deserialize JSON input to a specified type. If the top-level type is a Channel or a Flow, the object is returned immediately and the data is streamed asynchronously into it.