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:
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>
Why can't I access the array with index key. Please somebody help me? Thanks in advance.
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.