类 JacksonHelper
java.lang.Object
com.github.codeboyzhou.mcp.declarative.util.JacksonHelper
Helper class for Jackson JSON and YAML serialization and deserialization.
This class provides static methods for serializing and deserializing objects to and from JSON and YAML formats using Jackson.
- 作者:
- codeboyzhou
-
方法概要
修饰符和类型方法说明static <T> TDeserialize a JSON string to an object of the specified type.static <T> TDeserialize a YAML file to an object of the specified type.static StringtoJsonString(Object object) Serialize an object to a JSON string.
-
方法详细资料
-
toJsonString
Serialize an object to a JSON string.- 参数:
object- the object to serialize- 返回:
- the JSON string representation of the object
-
fromJson
Deserialize a JSON string to an object of the specified type.- 类型参数:
T- the type of the object to deserialize to- 参数:
json- the JSON string to deserializevalueType- the class of the object to deserialize to- 返回:
- the deserialized object
-
fromYaml
Deserialize a YAML file to an object of the specified type.- 类型参数:
T- the type of the object to deserialize to- 参数:
yamlFile- the YAML file to deserializevalueType- the class of the object to deserialize to- 返回:
- the deserialized object
-