Package com.gpudb.util.json
Class JsonUtils
- java.lang.Object
-
- com.gpudb.util.json.JsonUtils
-
public class JsonUtils extends Object
-
-
Constructor Summary
Constructors Constructor Description JsonUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> booleanisListOfRecordBase(List<T> list)static <T> booleanisListOfStrings(List<T> list)static booleanisListOfValidJsonStrings(List<String> list)static booleanisValidJson(String jsonStr)static booleanisValidJsonArray(String jsonStr)static StringtoJsonArray(List<String> list)Converts a Listto a JSON array where each element is a valid JSON String static StringtoJsonString(Object value)Wrapper for ObjectMapper().writeValueAsString that throws GPUdbException
-
-
-
Method Detail
-
isValidJson
public static boolean isValidJson(String jsonStr)
-
isValidJsonArray
public static boolean isValidJsonArray(String jsonStr)
-
isListOfStrings
public static <T> boolean isListOfStrings(List<T> list)
-
isListOfRecordBase
public static <T> boolean isListOfRecordBase(List<T> list)
-
toJsonArray
public static String toJsonArray(List<String> list)
Converts a Listto a JSON array where each element is a valid JSON String - Parameters:
list- - the parameterized input list- Returns:
- a string representation of a JSON array of the given list of JSON strings
-
toJsonString
public static String toJsonString(Object value) throws GPUdbException
Wrapper for ObjectMapper().writeValueAsString that throws GPUdbException- Parameters:
value- - object to convert to JSON string- Returns:
- a JSON string representation of the given object
- Throws:
GPUdbException
-
-