パッケージ org.thinkit.zenna.util
クラス JsonConverter
java.lang.Object
org.thinkit.zenna.util.JsonConverter
public final class JsonConverter extends Object
This class defines a generic conversion process for json using the Jackson
library.
Use the methods defined in JsonConverter
to perform the json
conversion process. Use toObject(String, TypeReference)
to convert it to an object with generic information.
- 導入されたバージョン:
- 1.0.0
-
メソッドの概要
修飾子とタイプ メソッド 説明 static Map<String,Object>
toLinkedHashMap(@NonNull String jsonString)
Converts the JSON string passed as an argument to aLinkedHashMap
structure.static <T> T
toObject(@NonNull String jsonString, @NonNull com.fasterxml.jackson.core.type.TypeReference<T> valueTypeRef)
Converts the object specified as an argument to an arbitrary structure.
-
メソッドの詳細
-
toLinkedHashMap
Converts the JSON string passed as an argument to aLinkedHashMap
structure.- パラメータ:
jsonString
- The JSON string to be converted- 戻り値:
- The JSON map based on
LinkedHashMap
- 例外:
NullPointerException
- Ifnull
was passed as an argumentContentParsingException
- If there is a syntax error in the JSON string
-
toObject
public static <T> T toObject(@NonNull @NonNull String jsonString, @NonNull @NonNull com.fasterxml.jackson.core.type.TypeReference<T> valueTypeRef)Converts the object specified as an argument to an arbitrary structure.- 型パラメータ:
T
- The type after conversion- パラメータ:
jsonString
- The JSON stringvalueTypeRef
- The type reference object- 戻り値:
- The converted object
- 例外:
NullPointerException
- Ifnull
was passed as an argumentContentParsingException
- If there is a syntax error in the JSON string
-