Q:

How to loop through array of structures in ColdFusion

I have this array of structures setup:
<cfset table_columns = [
    {name="Right Name", var_name="right_name",  searchable="true", sortable="true"},
    {name="Right Type", var_name="right_type", searchable="true", sortable="true"},
    {name="Right Description", var_name="right_descr", searchable="true", sortable="true"},
    {name="Edit", var_name = "editcol", searchable="false", sortable="false"}
]>

How would I loop through that? Here is an example of what I need to do (which is obviously not working):
<cfloop array="#table_columns#" index="data_index">
    {"sName": "#table_columns[data_index]['name']#", "sTitle": "#table_columns[data_index]['var_name']#", "bsearchable": "#table_columns[data_index]['searchable']#", "bsortable": "#table_columns[data_index]['sortable']#"},
</cfloop>

A:

With an array loop, the index value is an element of the array, not a position. Meaning data_index is a structure. So you can output the keys as usual (with either structure or dot notation).
<cfloop array="#table_columns#" index="data_index">
    {"sName": "#data_index['name']#", "sTitle": "#data_index['var_name']#", "bsearchable": "#data_index['searchable']#", "bsortable": "#data_index['sortable']#"},
</cfloop>

