Object JsonToolkit
-
- All Implemented Interfaces:
public class JsonToolkitToutatis_Gc
-
-
Field Summary
Fields Modifier and Type Field Description public final static IntegerDEFAULT_MAX_RECORDpublic final static JsonToolkitINSTANCE
-
Method Summary
Modifier and Type Method Description final static JSONObjectparseJsonObject(File file)将json文件内容转换为json对象 final static JSONObjectparseJsonObject(String jsonString)final static JSONObjectparseJsonObject(Object obj)将任意对象转换为json对象 final static <T extends Any> TgetValue(JSONObject obj, String key, Class<T> type)此方法获取以分隔符(.) 分隔的键,向下迭代以获取值. final static HashMap<String, JSONObject>getInnerMap()final static StringgetString(JSONObject obj, String key)final static IntegergetInteger(JSONObject obj, String key)final static BooleangetBoolean(JSONObject obj, String key)final static UnitsetMaxRecordNum(Integer num)Change the maximum record value of recordJSONMap -
-
Method Detail
-
parseJsonObject
final static JSONObject parseJsonObject(File file)
将json文件内容转换为json对象
-
parseJsonObject
final static JSONObject parseJsonObject(String jsonString)
-
parseJsonObject
final static JSONObject parseJsonObject(Object obj)
将任意对象转换为json对象
-
getValue
final static <T extends Any> T getValue(JSONObject obj, String key, Class<T> type)
此方法获取以分隔符(.) 分隔的键,向下迭代以获取值.
This method gets the delimiter (.) Delimited keys, iterating down to get the value.
example: 获取json对象"obj.key1.key2.key3"的值111 { key1:{ key2: { key3: 111 } } }
-
getInnerMap
final static HashMap<String, JSONObject> getInnerMap()
-
getInteger
final static Integer getInteger(JSONObject obj, String key)
-
getBoolean
final static Boolean getBoolean(JSONObject obj, String key)
-
setMaxRecordNum
final static Unit setMaxRecordNum(Integer num)
Change the maximum record value of recordJSONMap
- Parameters:
num- Allows the size of a map to be recorded
-
-
-
-