Package dev.langchain4j.internal
Class Json
java.lang.Object
dev.langchain4j.internal.Json
Deprecated.
A utility class for JSON.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Deprecated.The abstract JSON codec interface. -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> T
Deprecated.use Jackson's ObjectMapperstatic <T> T
Deprecated.use Jackson's ObjectMapperstatic InputStream
toInputStream
(Object o, Class<?> type) Deprecated.use Jackson's ObjectMapperstatic String
Deprecated.use Jackson's ObjectMapper
-
Method Details
-
toJson
Deprecated.use Jackson's ObjectMapperConvert the given object to JSON.- Parameters:
o
- the object to convert.- Returns:
- the JSON string.
-
fromJson
Deprecated.use Jackson's ObjectMapperConvert the given JSON string to an object of the given class.- Type Parameters:
T
- the type of the object.- Parameters:
json
- the JSON string.type
- the class of the object.- Returns:
- the object.
-
fromJson
Deprecated.use Jackson's ObjectMapperConvert the given JSON string to an object of the given type.- Type Parameters:
T
- the type of the object.- Parameters:
json
- the JSON string.type
- the type of the object.- Returns:
- the object.
-
toInputStream
Deprecated.use Jackson's ObjectMapperConvert the given object to anInputStream
.- Parameters:
o
- the object to convert.type
- the type of the object.- Returns:
- the
InputStream
. - Throws:
IOException
- if an I/O error occurs.
-
Json
from third-party modules. If you need to serialize/deserialize JSON in third-party modules, use Jackson's ObjectMapper.Json
can be used only bylangchain4j-core
andlangchain4j
modules.