Package org.alfresco.util
Class JSONtoFmModel
- java.lang.Object
-
- org.alfresco.util.JSONtoFmModel
-
public final class JSONtoFmModel extends Object
Utility to convert JSON to Freemarker-compatible data model- Author:
- janv
-
-
Field Summary
Fields Modifier and Type Field Description static booleanautoConvertISO8601static StringROOT_ARRAY
-
Constructor Summary
Constructors Constructor Description JSONtoFmModel()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static List<Object>convertJSONArrayToList(org.json.JSONArray ja)JSONArray is an ordered sequence of values -> convert to List (equivalent to Freemarker "sequence")static Map<String,Object>convertJSONArrayToMap(String jsonString)Convert JSON Array string to Freemarker-compatible data modelstatic Map<String,Object>convertJSONObjectToMap(String jsonString)Convert JSON Object string to Freemarker-compatible data modelstatic Map<String,Object>convertJSONObjectToMap(org.json.JSONObject jo)JSONObject is an unordered collection of name/value pairs -> convert to Map (equivalent to Freemarker "hash")static StringtoString(Map<String,Object> map)
-
-
-
Field Detail
-
ROOT_ARRAY
public static String ROOT_ARRAY
-
autoConvertISO8601
public static boolean autoConvertISO8601
-
-
Method Detail
-
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
-
-