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 Details

    • ROOT_ARRAY

      public static String 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

      public static String toString(Map<String,Object> map)