Package io.vertx.core.spi.json

## Interface JsonCodec

- All Known Implementing Classes:
    `DatabindCodec`, `JacksonCodec`

      public interface JsonCodec

  Author:
    Julien Viet

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `<T> T` | `fromBuffer​(Buffer json, Class<T> clazz)` | Like `fromString(String, Class)` but with a json `Buffer`
    `<T> T` | `fromString​(String json, Class<T> clazz)` | Decode the provide `json` string to an object extending `clazz`.
    `<T> T` | `fromValue​(Object json, Class<T> toValueType)` | Like `fromString(String, Class)` but with a json `Object`
    `default Buffer` | `toBuffer​(Object object)` | Like `toString(Object)` but with a json `Buffer`
    `Buffer` | `toBuffer​(Object object, boolean pretty)` | Like `toString(Object, boolean)` but with a json `Buffer`
    `default String` | `toString​(Object object)` | Encode the specified `object` to a string.
    `String` | `toString​(Object object, boolean pretty)` | Encode the specified `object` to a string.

- - ### Method Detail

    - #### fromString

          <T> T fromString​(String json,
                           Class<T> clazz)
                    throws DecodeException

      Decode the provide `json` string to an object extending `clazz`.
      Parameters:
        `json` - the json string
        `clazz` - the required object's class
      Returns:
        the instance
      Throws:
        `DecodeException` - anything preventing the decoding

    - #### fromBuffer

          <T> T fromBuffer​(Buffer json,
                           Class<T> clazz)
                    throws DecodeException

      Like `fromString(String, Class)` but with a json `Buffer`
      Throws:
        `DecodeException`

    - #### fromValue

          <T> T fromValue​(Object json,
                          Class<T> toValueType)

      Like `fromString(String, Class)` but with a json `Object`

    - #### toString

          default String toString​(Object object)
                           throws EncodeException

      Encode the specified `object` to a string.
      Throws:
        `EncodeException`

    - #### toString

          String toString​(Object object,
                          boolean pretty)
                   throws EncodeException

      Encode the specified `object` to a string.
      Parameters:
        `object` - the object to encode
        `pretty` - `true` to format the string prettily
      Returns:
        the json encoded string
      Throws:
        `DecodeException` - anything preventing the encoding
        `EncodeException`

    - #### toBuffer

          Buffer toBuffer​(Object object,
                          boolean pretty)
                   throws EncodeException

      Like `toString(Object, boolean)` but with a json `Buffer`
      Throws:
        `EncodeException`

    - #### toBuffer

          default Buffer toBuffer​(Object object)
                           throws EncodeException

      Like `toString(Object)` but with a json `Buffer`
      Throws:
        `EncodeException`