Deprecated Json from langchain4j-core

langchain4j-core should not depend on Gson
This commit is contained in:
LangChain4j 2024-09-20 17:31:32 +02:00
parent 4af5306d50
commit 84915ba03e
1 changed files with 9 additions and 0 deletions

View File

@ -9,7 +9,10 @@ import static dev.langchain4j.spi.ServiceHelper.loadFactories;
/**
* A utility class for JSON.
*
* @deprecated use Jackson's ObjectMapper
*/
@Deprecated
public class Json {
private Json() {
}
@ -62,7 +65,9 @@ public class Json {
*
* @param o the object to convert.
* @return the JSON string.
* @deprecated use Jackson's ObjectMapper
*/
@Deprecated
public static String toJson(Object o) {
return CODEC.toJson(o);
}
@ -74,7 +79,9 @@ public class Json {
* @param type the type of the object.
* @param <T> the type of the object.
* @return the object.
* @deprecated use Jackson's ObjectMapper
*/
@Deprecated
public static <T> T fromJson(String json, Class<T> type) {
return CODEC.fromJson(json, type);
}
@ -86,7 +93,9 @@ public class Json {
* @param type the type of the object.
* @return the {@link InputStream}.
* @throws IOException if an I/O error occurs.
* @deprecated use Jackson's ObjectMapper
*/
@Deprecated
public static InputStream toInputStream(Object o, Class<?> type) throws IOException {
return CODEC.toInputStream(o, type);
}