AnsweredAssumed Answered

Association properties in json.ftl

Question asked by nikhilaraballi on Feb 27, 2014
Latest reply on Feb 27, 2014 by nikhilaraballi
How to get properties of association object using json.ftl?

I have a type abc:appDate.  It has a property abc:dateTime an association to self ie.,

    <association name="abc:nextAppDate">
    <title>Next App Date</title>

I was trying to get properties of association as below, but getting "Error during processing of the template 'Expression result.assocs[\"abc:nextAppDate\"] is undefined"

    <#macro dateFormat date>${date?string("dd MMM yyyy")}</#macro>
        <#escape x as jsonUtils.encodeJSONString(x)>
           "nodeRef": "${result.nodeRef}",   
           "date": "<@dateFormat["abc:dateTime"] />",
            "nextDate": [
          <#list result.assocs["abc:nextAppDate"] as childKey>
          "date": "<@dateFormat["abc:dateTime"] />"            
          <#if child_has_next>,</#if>