Package dev.langchain4j.internal
Interface Json.JsonCodec
-
- All Implemented Interfaces:
public interface Json.JsonCodec
The abstract JSON codec interface.
-
-
Method Summary
Modifier and Type Method Description abstract String
toJson(Object o)
Convert the given object to JSON. abstract <T> T
fromJson(String json, Class<T> type)
Convert the given JSON string to an object of the given class. abstract <T> T
fromJson(String json, Type type)
Convert the given JSON string to an object of the given type. abstract InputStream
toInputStream(Object o, Class<out Object> type)
Convert the given object to an InputStream. -
-
Method Detail
-
toJson
abstract String toJson(Object o)
Convert the given object to JSON.
- Parameters:
o
- the object to convert.- Returns:
the JSON string.
-
fromJson
abstract <T> T fromJson(String json, Class<T> type)
Convert the given JSON string to an object of the given class.
- Parameters:
json
- the JSON string.type
- the class of the object.- Returns:
the object.
-
fromJson
abstract <T> T fromJson(String json, Type type)
Convert the given JSON string to an object of the given type.
- Parameters:
json
- the JSON string.type
- the type of the object.- Returns:
the object.
-
toInputStream
abstract InputStream toInputStream(Object o, Class<out Object> type)
Convert the given object to an InputStream.
- Parameters:
o
- the object to convert.type
- the type of the object.- Returns:
the InputStream.
-
-
-
-