Package 

Interface JsonMapper

    • Method Summary

      Modifier and Type Method Description
      String toJsonString(@NotNull() Object obj) Javalin uses this method for json,as well as the CookieStore class, WebSockets messaging, and JavalinVue.
      InputStream toJsonStream(@NotNull() Object obj) Javalin uses this method for json,if called with useStreamingMapper = true.When implementing this method, use (or look at) PipedStreamUtil to getan InputStream from an OutputStream.
      <T> T fromJsonString(@NotNull() String json, @NotNull() Class<T> targetClass) If fromJsonStream is not implemented, Javalin will use this methodwhen mapping request bodies to JSON through bodyAsClass.
      <T> T fromJsonStream(@NotNull() InputStream json, @NotNull() Class<T> targetClass) If implemented, Javalin will use this method instead of fromJsonString when mapping request bodies to JSON through bodyAsClass.
      • Methods inherited from class java.lang.Object

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

      • toJsonString

        @NotNull() String toJsonString(@NotNull() Object obj)

        Javalin uses this method for json,as well as the CookieStore class, WebSockets messaging, and JavalinVue.

      • toJsonStream

        @NotNull() InputStream toJsonStream(@NotNull() Object obj)

        Javalin uses this method for json,if called with useStreamingMapper = true.When implementing this method, use (or look at) PipedStreamUtil to getan InputStream from an OutputStream.

      • fromJsonString

        @NotNull() <T> T fromJsonString(@NotNull() String json, @NotNull() Class<T> targetClass)

        If fromJsonStream is not implemented, Javalin will use this methodwhen mapping request bodies to JSON through bodyAsClass.Regardless of if fromJsonStream is implemented, Javalin willuse this method for Validation and for WebSocket messaging.

      • fromJsonStream

        @NotNull() <T> T fromJsonStream(@NotNull() InputStream json, @NotNull() Class<T> targetClass)

        If implemented, Javalin will use this method instead of fromJsonString when mapping request bodies to JSON through bodyAsClass.