Package com.targomo.client.api.util
Class JsonUtil
java.lang.Object
com.targomo.client.api.util.JsonUtil
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleangetBoolean(org.json.JSONObject jsonConfig, String key) static Doublestatic IntegergetInt(org.json.JSONArray array, int index) static Integerstatic org.json.JSONArraygetJsonArray(org.json.JSONObject object, String key) static org.json.JSONObjectgetJSONObject(org.json.JSONArray array, int index) static org.json.JSONObjectgetJSONObject(org.json.JSONObject jsonConfig, String key) getKeys(org.json.JSONObject results) static longgetSortedIntKeySet(org.json.JSONObject object) static Stringstatic org.json.JSONArrayparseArray(String config) static org.json.JSONObjectparseString(String config) Parse configuration stringstatic voidput(org.json.JSONArray jsonArray, org.json.JSONArray innerBoundary) static voidput(org.json.JSONArray array, org.json.JSONObject object) static org.json.JSONObjectstatic org.json.JSONObjectstatic org.json.JSONObjectPut String inside JSONObjectstatic org.json.JSONObjectPut array to JSONObjectstatic org.json.JSONObjectPut object inside another JSONObjectstatic StringtoString(org.json.JSONObject config, int intendation)
-
Constructor Details
-
JsonUtil
public JsonUtil()
-
-
Method Details
-
put
public static void put(org.json.JSONArray array, org.json.JSONObject object) -
put
public static void put(org.json.JSONArray jsonArray, org.json.JSONArray innerBoundary) -
put
public static org.json.JSONObject put(org.json.JSONObject object, String string, org.json.JSONArray jsonArray) Put array to JSONObject- Parameters:
object- JSONObject that the array will be insterted intostring- Key for the arrayjsonArray- The array to be put- Returns:
- Updated JSONObject
-
put
-
put
-
put
public static org.json.JSONObject put(org.json.JSONObject object, String string, org.json.JSONObject jsonObject) Put object inside another JSONObject- Parameters:
object- Parent objectstring- Key for the child objectjsonObject- Child object- Returns:
- Resulting parent object with child object
-
put
Put String inside JSONObject- Parameters:
object- Parent objectstring- Key for the stringvalue- The string- Returns:
- Resulting parent object with child object
-
parseString
Parse configuration string- Parameters:
config- Configuration string- Returns:
- Parsed JSONObject
- Throws:
TargomoClientRuntimeException- In case of any parse errors
-
parseArray
- Throws:
TargomoClientRuntimeException
-
getInt
public static Integer getInt(org.json.JSONObject jsonConfig, String key) throws TargomoClientRuntimeException - Throws:
TargomoClientRuntimeException
-
getString
public static String getString(org.json.JSONObject jsonConfig, String key) throws TargomoClientRuntimeException - Throws:
TargomoClientRuntimeException
-
getBoolean
public static boolean getBoolean(org.json.JSONObject jsonConfig, String key) throws TargomoClientRuntimeException - Throws:
TargomoClientRuntimeException
-
getJSONObject
public static org.json.JSONObject getJSONObject(org.json.JSONObject jsonConfig, String key) throws TargomoClientRuntimeException - Throws:
TargomoClientRuntimeException
-
getLong
public static long getLong(org.json.JSONObject object, String key) throws TargomoClientRuntimeException - Throws:
TargomoClientRuntimeException
-
getJsonArray
public static org.json.JSONArray getJsonArray(org.json.JSONObject object, String key) throws TargomoClientRuntimeException - Throws:
TargomoClientRuntimeException
-
getInt
public static Integer getInt(org.json.JSONArray array, int index) throws TargomoClientRuntimeException - Throws:
TargomoClientRuntimeException
-
getDouble
public static Double getDouble(org.json.JSONObject object, String key) throws TargomoClientRuntimeException - Throws:
TargomoClientRuntimeException
-
getJSONObject
public static org.json.JSONObject getJSONObject(org.json.JSONArray array, int index) throws TargomoClientRuntimeException - Throws:
TargomoClientRuntimeException
-
toString
public static String toString(org.json.JSONObject config, int intendation) throws TargomoClientRuntimeException - Throws:
TargomoClientRuntimeException
-
getKeys
-
getSortedIntKeySet
-