Cannot loop simple array

I have done this many time before but I'm not sure what is wrong with my code. I just need to loop this simple array:

enter image description here

Here is my code:

<cfoutput>
    <cfset myData = deserializeJSON(getHttpRequestData().content) />

<cfdump var="#myData#" />
  <cfloop from="1" to="#ArrayLen(myData)#" index="i">
   Type #i#: #myData[i]#<br>
  </cfloop>
</cfoutput>

But I'm getting this error: enter image description here

Why can't I access the array with index key. Please somebody help me? Thanks in advance.

1 answer

  • answered 2018-12-05 20:12 Dan Bracuk

    Variable myData appears to be an array of structures. That means myData[i] is a structure, and you can't simply output it.

    You have to do something else. What that something else is depends on your overall objective.