cancel
Showing results for 
Search instead for 
Did you mean: 

JSON notation

stevescott
Champ in-the-making
Champ in-the-making
I'm having issues consuming the json returned by alfresco…do I have the notation right?

<#setting locale="en_US">
{
   lectures: [
   <#list nodes as lecture>
         {"name": "${lecture.properties.name}","pub": "${lecture.properties["cm:modified"]?string("dd-MMM-yyyy hh:mm")}","url": "${lecture.url}"}
   </#list>
   ]
}
2 REPLIES 2

gyro_gearless
Champ in-the-making
Champ in-the-making
Hi,

when emitting lists, you have to take care to terminate all but the last element with a ","

Here is some .ftl which shows the trick:

{
  nodeRef : "${nodeRef}",


  permissions : [
  <#list permissions as perm>
  {
    authority: "${perm.authority}"
    ,permission: "${perm.permission}"
    ,inherited: <#if (perm.isInherited())>true<#else>false</#if>
  }
  <#if !(perm==permissions?last)>,</#if>
  </#list>
  ]
}


HTH
Gyro

hsohaib
Champ on-the-rise
Champ on-the-rise
best use a json serializer like flexjson, works like charme