Package org.alfresco.util
Class JSONtoFmModel
java.lang.Object
org.alfresco.util.JSONtoFmModel
Utility to convert JSON to Freemarker-compatible data model
- Author:
- janv
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconvertJSONArrayToList(org.json.JSONArray ja) JSONArray is an ordered sequence of values -> convert to List (equivalent to Freemarker "sequence")convertJSONArrayToMap(String jsonString) Convert JSON Array string to Freemarker-compatible data modelconvertJSONObjectToMap(String jsonString) Convert JSON Object string to Freemarker-compatible data modelconvertJSONObjectToMap(org.json.JSONObject jo) JSONObject is an unordered collection of name/value pairs -> convert to Map (equivalent to Freemarker "hash")static String
-
Field Details
-
ROOT_ARRAY
-
autoConvertISO8601
public static boolean autoConvertISO8601
-
-
Constructor Details
-
JSONtoFmModel
public JSONtoFmModel()
-
-
Method Details
-
convertJSONObjectToMap
public static Map<String,Object> convertJSONObjectToMap(String jsonString) throws org.json.JSONException Convert JSON Object string to Freemarker-compatible data model- Parameters:
jsonString- String- Returns:
- model
- Throws:
org.json.JSONException
-
convertJSONObjectToMap
public static Map<String,Object> convertJSONObjectToMap(org.json.JSONObject jo) throws org.json.JSONException JSONObject is an unordered collection of name/value pairs -> convert to Map (equivalent to Freemarker "hash")- Throws:
org.json.JSONException
-
convertJSONArrayToMap
public static Map<String,Object> convertJSONArrayToMap(String jsonString) throws org.json.JSONException Convert JSON Array string to Freemarker-compatible data model- Parameters:
jsonString- String- Returns:
- model
- Throws:
org.json.JSONException
-
convertJSONArrayToList
public static List<Object> convertJSONArrayToList(org.json.JSONArray ja) throws org.json.JSONException JSONArray is an ordered sequence of values -> convert to List (equivalent to Freemarker "sequence")- Throws:
org.json.JSONException
-
toString
-