Created
March 19, 2026 04:43
-
-
Save trycf/51c901961fc7681a15e5b0d9b856a07f to your computer and use it in GitHub Desktop.
TryCF Gist
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <cfset animal = createobject("component", "Animal")> | |
| <cfsavecontent variable="jsonstr">{"animal":{"id":1,"name":"chicken","eats":"chicken food","says":"cluck cluck"}}</cfsavecontent> | |
| <cfset decoded = deserializejson(jsonstr).animal> | |
| <cfset animal.setId(decoded.id).setName(decoded.name).setEats(decoded.eats).setSays(decoded.says)> | |
| <cfscript> | |
| // Lucee | |
| typedArray = arrayNew(dimension: 1, synchronized : true, type:"Animal"); | |
| //ACF v1 - syntax listed would throw error in Lucee, but creates an array type Animals | |
| //typedArray = arrayNew(dimension: 1, issynchronized : true, typename:"Animal"); | |
| //ACF v2 - this is the alleged way, but it does not create an array type Animals | |
| //typedArray = arrayNew["Animal"]( dimensions:1, issynchronized : true); | |
| //ACF v3 - this is the alleged way, but AND does create an array type Animals | |
| //typedArray = arrayNew["Animal"]( 1, true); | |
| typedArray[1] = animal; | |
| </cfscript> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment