public class JsonUtil
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static java.lang.Object |
convertJsonItem(java.lang.Object o)
Returns a Java object representation of objects that are
encountered inside of JSON created using the org.json package.
|
static java.lang.String |
getJsonRepresentation(java.lang.Object value) |
static java.util.List<java.lang.Object> |
getListFromJsonArray(org.json.JSONArray jArray)
Returns a Java Object list of a JSONArray with each item in
the array converted using convertJsonItem().
|
static java.util.List<java.lang.Object> |
getListFromJsonObject(org.json.JSONObject jObject)
Returns a list containing one two item list per key in jObject.
|
static java.lang.Object |
getObjectFromJson(java.lang.String jsonString) |
static java.util.List<java.lang.String> |
getStringListFromJsonArray(org.json.JSONArray jArray)
Returns a list of String objects from a JSONArray.
|
public static java.util.List<java.lang.String> getStringListFromJsonArray(org.json.JSONArray jArray) throws org.json.JSONException
jArray
- The JSONArray to convert.org.json.JSONException
- if an element of jArray cannot be
converted to a String.public static java.util.List<java.lang.Object> getListFromJsonArray(org.json.JSONArray jArray) throws org.json.JSONException
jArray
- The JSONArray to convert.org.json.JSONException
- if an element in jArray cannot be
converted properly.public static java.util.List<java.lang.Object> getListFromJsonObject(org.json.JSONObject jObject) throws org.json.JSONException
jObject
- The JSONObject to convert.org.json.JSONException
- if an element in jObject cannot be
converted properly.public static java.lang.Object convertJsonItem(java.lang.Object o) throws org.json.JSONException
o
- An item in a JSON array or JSON object to convert.org.json.JSONException
- if o fails to parse.public static java.lang.String getJsonRepresentation(java.lang.Object value) throws org.json.JSONException
org.json.JSONException
public static java.lang.Object getObjectFromJson(java.lang.String jsonString) throws org.json.JSONException
org.json.JSONException