パッケージ 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
  • メソッドの詳細

    • toLinkedHashMap

      public static Map<String,​Object> toLinkedHashMap​(@NonNull @NonNull String jsonString)
      Converts the JSON string passed as an argument to a LinkedHashMap structure.
      パラメータ:
      jsonString - The JSON string to be converted
      戻り値:
      The JSON map based on LinkedHashMap
      例外:
      NullPointerException - If null was passed as an argument
      ContentParsingException - 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 string
      valueTypeRef - The type reference object
      戻り値:
      The converted object
      例外:
      NullPointerException - If null was passed as an argument
      ContentParsingException - If there is a syntax error in the JSON string