Created
April 2, 2013 01:41
-
-
Save adamcameron/5289311 to your computer and use it in GitHub Desktop.
Demonstrating ColdFusion messing with boolean values from JSON
This file contains 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
<cfsavecontent variable="json"> | |
{ | |
"trueMatch1": { | |
"setting": true | |
}, | |
"falseMatch": { | |
"setting": false | |
}, | |
"trueMatch2": { | |
"setting": true | |
} | |
} | |
</cfsavecontent> | |
<cfscript> | |
struct = deserializeJSON(json); | |
writeDump(var=struct, label="Whole thing"); | |
writeDump(var=structFindValue(struct, true, "all"), label="Matched values for 'true'"); | |
writeOutput("Value of struct.trueMatch1.setting: [#struct.trueMatch1.setting#]<br>"); | |
writeOutput("Value of struct.trueMatch2.setting: [#struct.trueMatch2.setting#]<br>"); | |
shouldBeYes = struct.trueMatch1.setting; | |
writeOutput("shouldBeYes: [#shouldBeYes#]<br>"); | |
writeDump(var=structFindValue(struct, shouldBeYes, "all"), label="Matches for value pulled out of the struct we're actually looking in"); | |
</cfscript> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment