import com.google.gson.Gson; /** * This script will import a JSON array of all namespaces into current AEM instance * Each JSON object in the array should be of the format: * {"prefix":"The namespace prefix", "uri":"The namespace uri"} */ // Add the exported prefixes (from previous) into this string def jsonString = '[{"prefix":"stFNT","uri":"http://ns.adobe.com/xap/1.0/sType/Font#"}] class NameSpace { String prefix; String uri; } def gson = new Gson() NameSpace[] namespaces = gson.fromJson(jsonString, NameSpace[].class); def reg = session.getWorkspace().getNamespaceRegistry(); namespaces.each{ n -> print "Registering namespace: prefix=${n.prefix}, uri=${n.uri}" reg.registerNamespace(n.prefix, n.uri) // register the namespace }