Class JsonUtil
java.lang.Object
io.getlime.security.powerauth.lib.cmd.util.JsonUtil
public class JsonUtil
extends java.lang.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, java.lang.String key)Extract int value from JSON object stored using key with given key.static longlongValue(org.json.simple.JSONObject o, java.lang.String key)Extract long value from JSON object stored using key with given key.static java.lang.StringstringValue(org.json.simple.JSONObject o, java.lang.String key)Extract String value from JSON object stored using key with given name.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
JsonUtil
public JsonUtil()
-
-
Method Details
-
longValue
public static long longValue(org.json.simple.JSONObject o, java.lang.String key)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
public static int intValue(org.json.simple.JSONObject o, java.lang.String key)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
public static java.lang.String stringValue(org.json.simple.JSONObject o, java.lang.String key)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.
-