Class JsonUtil
java.lang.Object
io.getlime.security.powerauth.lib.cmd.util.JsonUtil
Helper class for obtaining typed values from JSON.
- Author:
- Roman Strobl, roman.strobl@wultra.com
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intExtract int value from JSON object stored using key with given key.static longExtract 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.
-