public class JsonUtils extends Object
| Constructor and Description |
|---|
JsonUtils() |
| Modifier and Type | Method and Description |
|---|---|
static Boolean |
getBooleanValue(org.json.JSONObject jsonObject,
String property,
Boolean defaultValue)
Retrieve an Boolean value from a JSONObject
|
static Double |
getDoubleValue(org.json.JSONObject jsonObject,
String property,
Double defaultValue)
Retrieve an Double value from a JSONObject
|
static Integer |
getIntegerValue(org.json.JSONObject jsonObject,
String property,
Integer defaultValue)
Retrieve an Integer value from a JSONObject
|
static org.json.JSONArray |
getJsonArray(org.json.JSONObject jsonObject,
String property,
org.json.JSONArray defaultValue)
Retrieve an JSONArray value from a JSONObject
|
static org.json.JSONObject |
getJsonValue(org.json.JSONObject jsonObject,
String property,
org.json.JSONObject defaultValue)
Retrieve an JSONObject value from a JSONObject
|
static String |
getStringValue(org.json.JSONObject jsonObject,
String property,
String defaultValue)
Retrieve a string value from a JSONObject
|
static void |
updateValue(org.json.JSONObject jsonObject,
String property,
Boolean value)
Update a Boolean value in an JSONOject
|
static void |
updateValue(org.json.JSONObject jsonObject,
String property,
Double value)
Update a Double value in an JSONOject
|
static void |
updateValue(org.json.JSONObject jsonObject,
String property,
Integer value)
Update a Integer value in an JSONOject
|
static void |
updateValue(org.json.JSONObject jsonObject,
String property,
org.json.JSONArray value)
Update a JSONArray value in an JSONOject
|
static void |
updateValue(org.json.JSONObject jsonObject,
String property,
org.json.JSONObject value)
Update a JSONObject value in an JSONOject
|
static void |
updateValue(org.json.JSONObject jsonObject,
String property,
String value)
Update a String value in an JSONOject
|
public static String getStringValue(org.json.JSONObject jsonObject, String property, String defaultValue)
jsonObject - JSONObject to get value fromproperty - Property name of the valuedefaultValue - Default value if the property does not existpublic static void updateValue(org.json.JSONObject jsonObject,
String property,
String value)
throws org.json.JSONException
jsonObject - JSONObject to updateproperty - Name of the propertyvalue - New valueorg.json.JSONException - if update failspublic static Integer getIntegerValue(org.json.JSONObject jsonObject, String property, Integer defaultValue)
jsonObject - JSONObject to get value fromproperty - Property name of the valuedefaultValue - Default value if the property does not existpublic static void updateValue(org.json.JSONObject jsonObject,
String property,
Integer value)
throws org.json.JSONException
jsonObject - JSONObject to updateproperty - Name of the propertyvalue - New valueorg.json.JSONException - if update failspublic static Double getDoubleValue(org.json.JSONObject jsonObject, String property, Double defaultValue)
jsonObject - JSONObject to get value fromproperty - Property name of the valuedefaultValue - Default value if the property does not existpublic static void updateValue(org.json.JSONObject jsonObject,
String property,
Double value)
throws org.json.JSONException
jsonObject - JSONObject to updateproperty - Name of the propertyvalue - New valueorg.json.JSONException - if update failspublic static Boolean getBooleanValue(org.json.JSONObject jsonObject, String property, Boolean defaultValue)
jsonObject - JSONObject to get value fromproperty - Property name of the valuedefaultValue - Default value if the property does not existpublic static void updateValue(org.json.JSONObject jsonObject,
String property,
Boolean value)
throws org.json.JSONException
jsonObject - JSONObject to updateproperty - Name of the propertyvalue - New valueorg.json.JSONException - if update failspublic static org.json.JSONObject getJsonValue(org.json.JSONObject jsonObject,
String property,
org.json.JSONObject defaultValue)
jsonObject - JSONObject to get value fromproperty - Property name of the valuedefaultValue - Default value if the property does not existpublic static void updateValue(org.json.JSONObject jsonObject,
String property,
org.json.JSONObject value)
throws org.json.JSONException
jsonObject - to updateproperty - Name of the propertyvalue - New valueorg.json.JSONException - if update failspublic static org.json.JSONArray getJsonArray(org.json.JSONObject jsonObject,
String property,
org.json.JSONArray defaultValue)
jsonObject - JSONObject to get value fromproperty - Property name of the valuedefaultValue - Default value if the property does not existpublic static void updateValue(org.json.JSONObject jsonObject,
String property,
org.json.JSONArray value)
throws org.json.JSONException
jsonObject - to updateproperty - Name of the propertyvalue - New valueorg.json.JSONException - if update failsCopyright © 2022. All rights reserved.