接口 Json.JsonCodec

封闭类:
Json

public static interface Json.JsonCodec
The abstract JSON codec interface.
  • 方法详细资料

    • toJson

      String toJson(Object o)
      Convert the given object to JSON.
      参数:
      o - the object to convert.
      返回:
      the JSON string.
    • fromJson

      <T> T fromJson(String json, Class<T> type)
      Convert the given JSON string to an object of the given type.
      类型参数:
      T - the type of the object.
      参数:
      json - the JSON string.
      type - the type of the object.
      返回:
      the object.
    • toInputStream

      InputStream toInputStream(Object o, Class<?> type) throws IOException
      Convert the given object to an InputStream.
      参数:
      o - the object to convert.
      type - the type of the object.
      返回:
      the InputStream.
      抛出:
      IOException - if an I/O error occurs.