Returns a value in a structure or a structure in the specified path.

structGet(path) → returns any

structGet Argument Reference

path string

Pathname of variable that contains structure or array from which CFML retrieves the value. If there is no structure or array present in the path, this function creates structures or arrays to make it a valid variable path.

Examples sample code invoking the structGet function

Get a value in a structure using structGet

x = { y = { z=8 } };
writeDump( structGet("x.y.z") );

Expected Result: 8

Accidentially Modifying a Structure

The structGet function will modify the varaible x by adding a new structure x.a and also adds a key x.a.b to satisfy the path.

x = { y = { z=8 } };
writeDump( structGet("x.a.b") );

Accidentially Overwriting a variable using structGet

The value of x.y.z[2] will be set to an empty struct.

x = { y = { z=[1,2,3] } };
writeDump( structGet("x.y.z[2]") );

Fork me on GitHub