arrayToStruct

Transform the array to a struct, the index of the array is the key of the struct

arrayToStruct(array) → returns struct

Member Function Syntax

array.toStruct()

This function requires Lucee.  Not supported on Adobe ColdFusion, etc.

Argument Reference

array array
Required

Examples
Sample code invoking the arrayToStruct function

serializeJSON(arrayToStruct(["a","b"]));

Expected Result: {"2":"b","1":"a"}

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub