How to read array of object using jelly script?

I am trying to read the values from an array of an object using the jelly script but not able to do so.Following the script, I was trying to read the values but it is not working.

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="jelly:core" xmlns:g2="glide">
  <g:evaluate var="jvar_short_text" expression="RP.getWindowProperties().short_text" />
			  expression="RP.getWindowProperties().bot_param" />
   <table width="100%">
		 <j:forEach items="${jvar_bot_param}" var="jvar_param" indexVar="i">
			 <g:evaluate jelly="true" object="true">
				 var botparam = jelly.jvar_param[i].label;
				 var botName  = jelly.jvar_param[i].name;
     <tr id="dialog_buttons" class="buttons">
        <td colspan="2" align="right">
           <g:dialog_buttons_ok_cancel ok='return validateComments(${jvar_bot_param})' ok_type="button" cancel_type="button" />

Var jvar_bot_param has the following data:

"name": "incident_sysid",
"label": "Incident sysid",
"type": "text",
"default": "859245f94ffe7e80c5a3c3818110c7fc"

Can someone please look into my code and suggest me how to retrieve the data from array.

1 Answers How to read array of object using jelly script?

Try this, should work:

<j2:forEach items="$[jvar_bot_param]" indexVar='i'>
        var idx = parseInt("$[i]");
        var botparam = jvar_bot_param[idx].label;
        var botName = jvar_bot_param[idx].name;

1 year ago