Class JsonUtil
java.lang.Object
io.getlime.security.powerauth.lib.cmd.util.JsonUtil
public class JsonUtil extends Object
Helper class for obtaining typed values from JSON.
- Author:
- Roman Strobl, roman.strobl@wultra.com
-
Constructor Summary
Constructors Constructor Description JsonUtil() -
Method Summary
Modifier and Type Method Description static intintValue(org.json.simple.JSONObject o, String key)Extract int value from JSON object stored using key with given key.static longlongValue(org.json.simple.JSONObject o, String key)Extract long value from JSON object stored using key with given key.static StringstringValue(org.json.simple.JSONObject o, String key)Extract String value from JSON object stored using key with given name.
-
Constructor Details
-
JsonUtil
public JsonUtil()
-
-
Method Details
-
longValue
Extract long value from JSON object stored using key with given key. In case the deserialized value type is not numeric, value 0 is returned.- Parameters:
o- JSON object.key- Key name.- Returns:
- Extracted long value.
-
intValue
Extract int value from JSON object stored using key with given key. In case the deserialized value type is not numeric, value 0 is returned.- Parameters:
o- JSON object.key- Key name.- Returns:
- Extracted int value.
-
stringValue
Extract String value from JSON object stored using key with given name. In case the deserialized value type is not of String type, value "" is returned.- Parameters:
o- JSON object.key- Key name.- Returns:
- Extracted String value.
-