Class JsonUtils
java.lang.Object
com.michelin.cert.redscan.utils.json.JsonUtils
Json Utils.
- Author:
- Maxime ESCOURBIAC
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleangetSafeBoolean(kong.unirest.json.JSONObject json, String key) Safe method to extract boolean from Json Object.static intgetSafeInt(kong.unirest.json.JSONObject json, String key) Safe method to extract int from Json Object.static StringgetSafeString(kong.unirest.json.JSONObject json, String key) Safe method to extract string from Json Object.static String[]getSafeStringArray(kong.unirest.json.JSONObject json, String key) Safe method to inject string array to Json Object.static voidsetSafeBoolean(kong.unirest.json.JSONObject json, String key, Boolean value) Safe method to inject boolean to Json Object.static voidsetSafeInt(kong.unirest.json.JSONObject json, String key, int value) Safe method to inject int to Json Object.static voidsetSafeString(kong.unirest.json.JSONObject json, String key, String value) Safe method to inject string to Json Object.static voidsetSafeStringArray(kong.unirest.json.JSONObject json, String key, String[] values) Safe method to inject string array to Json Object.
-
Constructor Details
-
JsonUtils
public JsonUtils()
-
-
Method Details
-
getSafeString
Safe method to extract string from Json Object.- Parameters:
json- Json object.key- Key to extract.- Returns:
- Get the string associated with a key.
-
setSafeString
Safe method to inject string to Json Object.- Parameters:
json- Json object.key- Key to inject.value- Value to inject.
-
getSafeInt
Safe method to extract int from Json Object.- Parameters:
json- Json object.key- Key to extract.- Returns:
- Get the int associated with a key.
-
setSafeInt
Safe method to inject int to Json Object.- Parameters:
json- Json object.key- Key to inject.value- Value to inject.
-
getSafeBoolean
Safe method to extract boolean from Json Object.- Parameters:
json- Json object.key- Key to extract.- Returns:
- Get the boolean associated with a key.
-
setSafeBoolean
Safe method to inject boolean to Json Object.- Parameters:
json- Json object.key- Key to inject.value- Value to inject.
-
getSafeStringArray
Safe method to inject string array to Json Object.- Parameters:
json- Json object.key- Key to extract.- Returns:
- Get the string array associated with a key.
-
setSafeStringArray
public static void setSafeStringArray(kong.unirest.json.JSONObject json, String key, String[] values) Safe method to inject string array to Json Object.- Parameters:
json- Json object.key- Key to inject.values- Values to inject.
-