Whatever message this page gives is out now! Go check it out!

StructKeyArray

Last update:
May 18, 2026

Description

Finds the keys in a ColdFusion structure.

Returns

An array of keys; if structure does not exist, ColdFusion throws an exception.

Category

Syntax

StructKeyArray(structure)

See also

Structure functionsModifying a ColdFusion XML object in the Developing ColdFusion Applications

Parameters

Parameter
Description
structure
Structure from which to extract a list of keys.

Example

<cfscript>
       myStruct.John={age=30,skill="vocals"};
       myStruct.Paul={age=31,skill="guitar and vocals"};
       myStruct.George={age=32,skill="guitar"};
       myStruct.Ringo={age=33,skill="drums"};
       myNewArray=StructKeyArray(myStruct); //Finds the keys in struct myStruct
       WriteDump(myNewArray);
       // Try to return keys in an array that does not exist
       try{
             StructKeyArray(anotherArray);
       }
       catch (any s){
             WriteOutput(s.message); // Display message that anotherArray does not exist
       }
</cfscript>

Output

Figure: structkeyarray output
structkeyarray output

Using member function

<cfscript>
       myStruct = {a:1,b=2,c=3,d=4,e=5};
       myKeyArray=myStruct.keyArray();
       WriteDump(myKeyArray);
</cfscript>

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page