| 限定符和类型 | 字段和说明 |
|---|---|
static boolean |
isPrintException |
| 构造器和说明 |
|---|
JSONUtils() |
| 限定符和类型 | 方法和说明 |
|---|---|
static boolean |
getBoolean(org.json.JSONObject jsonObject,
String key,
Boolean defaultValue)
get Boolean from jsonObject
|
static boolean |
getBoolean(String jsonData,
String key,
Boolean defaultValue)
get Boolean from jsonData
|
static double |
getDouble(org.json.JSONObject jsonObject,
String key,
double defaultValue) |
static Double |
getDouble(org.json.JSONObject jsonObject,
String key,
Double defaultValue)
get Double from jsonObject
|
static double |
getDouble(String jsonData,
String key,
double defaultValue) |
static Double |
getDouble(String jsonData,
String key,
Double defaultValue)
get Double from jsonData
|
static int |
getInt(org.json.JSONObject jsonObject,
String key,
int defaultValue) |
static Integer |
getInt(org.json.JSONObject jsonObject,
String key,
Integer defaultValue)
get Int from jsonObject
|
static int |
getInt(String jsonData,
String key,
int defaultValue) |
static Integer |
getInt(String jsonData,
String key,
Integer defaultValue)
get Int from jsonData
|
static org.json.JSONArray |
getJSONArray(org.json.JSONObject jsonObject,
String key,
org.json.JSONArray defaultValue)
get JSONArray from jsonObject
|
static org.json.JSONArray |
getJSONArray(String jsonData,
String key,
org.json.JSONArray defaultValue)
get JSONArray from jsonData
|
static org.json.JSONObject |
getJSONObject(org.json.JSONObject jsonObject,
String key,
org.json.JSONObject defaultValue)
get JSONObject from jsonObject
|
static org.json.JSONObject |
getJSONObject(String jsonData,
String key,
org.json.JSONObject defaultValue)
get JSONObject from jsonData
|
static long |
getLong(org.json.JSONObject jsonObject,
String key,
long defaultValue) |
static Long |
getLong(org.json.JSONObject jsonObject,
String key,
Long defaultValue)
get Long from jsonObject
|
static long |
getLong(String jsonData,
String key,
long defaultValue) |
static Long |
getLong(String jsonData,
String key,
Long defaultValue)
get Long from jsonData
|
static Map<String,String> |
getMap(org.json.JSONObject jsonObject,
String key)
get map from jsonObject.
|
static Map<String,String> |
getMap(String jsonData,
String key)
get map from jsonData.
|
static String |
getString(org.json.JSONObject jsonObject,
String key,
String defaultValue)
get String from jsonObject
|
static String |
getString(String jsonData,
String key,
String defaultValue)
get String from jsonData
|
static String[] |
getStringArray(org.json.JSONObject jsonObject,
String key,
String[] defaultValue)
get String array from jsonObject
|
static String[] |
getStringArray(String jsonData,
String key,
String[] defaultValue)
get String array from jsonData
|
static Map<String,String> |
parseKeyAndValueToMap(org.json.JSONObject sourceObj)
parse key-value pairs to map. ignore empty key, if getValue exception, put empty value
|
static Map<String,String> |
parseKeyAndValueToMap(String source)
parse key-value pairs to map. ignore empty key, if getValue exception, put empty value
|
public static Long getLong(org.json.JSONObject jsonObject, String key, Long defaultValue)
jsonObject - key - defaultValue - JSONObject.getLong(String) exception, return defaultValueJSONObject.getLong(String)public static Long getLong(String jsonData, String key, Long defaultValue)
jsonData - key - defaultValue - JSONObject.JSONObject(String) exception, return defaultValueJSONUtils#getLong(JSONObject, String, JSONObject)public static long getLong(org.json.JSONObject jsonObject,
String key,
long defaultValue)
jsonObject - key - defaultValue - getLong(JSONObject, String, Long)public static long getLong(String jsonData, String key, long defaultValue)
jsonData - key - defaultValue - getLong(String, String, Long)public static Integer getInt(org.json.JSONObject jsonObject, String key, Integer defaultValue)
jsonObject - key - defaultValue - JSONObject.getInt(String) exception, return defaultValueJSONObject.getInt(String)public static Integer getInt(String jsonData, String key, Integer defaultValue)
jsonData - key - defaultValue - JSONObject.JSONObject(String) exception, return defaultValueJSONUtils#getInt(JSONObject, String, JSONObject)public static int getInt(org.json.JSONObject jsonObject,
String key,
int defaultValue)
jsonObject - key - defaultValue - getInt(JSONObject, String, Integer)public static int getInt(String jsonData, String key, int defaultValue)
jsonObject - key - defaultValue - getInt(String, String, Integer)public static Double getDouble(org.json.JSONObject jsonObject, String key, Double defaultValue)
jsonObject - key - defaultValue - JSONObject.getDouble(String) exception, return defaultValueJSONObject.getDouble(String)public static Double getDouble(String jsonData, String key, Double defaultValue)
jsonData - key - defaultValue - JSONObject.JSONObject(String) exception, return defaultValueJSONUtils#getDouble(JSONObject, String, JSONObject)public static double getDouble(org.json.JSONObject jsonObject,
String key,
double defaultValue)
jsonObject - key - defaultValue - getDouble(JSONObject, String, Double)public static double getDouble(String jsonData, String key, double defaultValue)
jsonObject - key - defaultValue - getDouble(String, String, Double)public static String getString(org.json.JSONObject jsonObject, String key, String defaultValue)
jsonObject - key - defaultValue - JSONObject.getString(String) exception, return defaultValueJSONObject.getString(String)public static String getString(String jsonData, String key, String defaultValue)
jsonData - key - defaultValue - JSONObject.JSONObject(String) exception, return defaultValueJSONUtils#getString(JSONObject, String, JSONObject)public static String[] getStringArray(org.json.JSONObject jsonObject, String key, String[] defaultValue)
jsonObject - key - defaultValue - JSONObject.getJSONArray(String) exception, return defaultValueJSONArray.getString(int) exception, return defaultValuepublic static String[] getStringArray(String jsonData, String key, String[] defaultValue)
jsonData - key - defaultValue - JSONObject.JSONObject(String) exception, return defaultValueJSONUtils#getStringArray(JSONObject, String, JSONObject)public static org.json.JSONObject getJSONObject(org.json.JSONObject jsonObject,
String key,
org.json.JSONObject defaultValue)
jsonObject - key - defaultValue - JSONObject.getJSONObject(String) exception, return defaultValueJSONObject.getJSONObject(String)public static org.json.JSONObject getJSONObject(String jsonData, String key, org.json.JSONObject defaultValue)
jsonData - key - defaultValue - JSONObject.JSONObject(String) exception, return defaultValuegetJSONObject(JSONObject, String, JSONObject)public static org.json.JSONArray getJSONArray(org.json.JSONObject jsonObject,
String key,
org.json.JSONArray defaultValue)
jsonObject - key - defaultValue - JSONObject.getJSONArray(String) exception, return defaultValueJSONObject.getJSONArray(String)public static org.json.JSONArray getJSONArray(String jsonData, String key, org.json.JSONArray defaultValue)
jsonData - key - defaultValue - JSONObject.JSONObject(String) exception, return defaultValueJSONUtils#getJSONArray(JSONObject, String, JSONObject)public static boolean getBoolean(org.json.JSONObject jsonObject,
String key,
Boolean defaultValue)
jsonObject - key - defaultValue - JSONObject.getBoolean(String)public static boolean getBoolean(String jsonData, String key, Boolean defaultValue)
jsonData - key - defaultValue - JSONObject.JSONObject(String) exception, return defaultValuegetBoolean(JSONObject, String, Boolean)public static Map<String,String> getMap(org.json.JSONObject jsonObject, String key)
jsonObject - key-value pairs jsonkey - parseKeyAndValueToMap(String)public static Map<String,String> getMap(String jsonData, String key)
jsonData - key-value pairs stringkey - JSONObject.JSONObject(String) exception, return nullgetMap(JSONObject, String)public static Map<String,String> parseKeyAndValueToMap(org.json.JSONObject sourceObj)
sourceObj - key-value pairs jsonMapUtils.putMapNotEmptyKey(Map, String, String) one by onepublic static Map<String,String> parseKeyAndValueToMap(String source)
source - key-value pairs jsonJSONObject.JSONObject(String) exception, return nullparseKeyAndValueToMap(JSONObject)Copyright © 2012-2014. All Rights Reserved.