Package dev.langchain4j.internal
Class Json
-
- All Implemented Interfaces:
public class Json
JSON helper class. It is supposed to be used by "tools" and "structured output" functionalities.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interface
Json.JsonCodec
The abstract JSON codec interface.
-
Method Summary
Modifier and Type Method Description static String
toJson(Object o)
Convert the given object to JSON. static <T> T
fromJson(String json, Class<T> type)
Convert the given JSON string to an object of the given class. static <T> T
fromJson(String json, Type type)
Convert the given JSON string to an object of the given type. -
-
Method Detail
-
toJson
static String toJson(Object o)
Convert the given object to JSON.
- Parameters:
o
- the object to convert.- Returns:
the JSON string.
-
fromJson
static <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.
-
-
-
-