Output query to json format.
Convert a struct to JSON using this JSONUtil.cfc
Output query to json format.
Convert a struct to JSON using this JSONUtil.cfc
| <cfset var jUtil = createObject("component", "functions.JSONUtil") | |
| <cfset j = StructNew()> | |
| <cfset j.optionsOther = StructNew()> | |
| <cfloop query="getOptionsOther"> | |
| <cfset tempName = trim(getOptionsOther.varKey)> | |
| <!--- Turn key to json format ---> | |
| <cfset tempKey = replace(LCase(tempName)," ", "_", "all")> | |
| <cfset tempKey = replace(tempKey,"(", "", "all")> | |
| <cfset tempKey = replace(tempKey,")", "", "all")> | |
| <cfset j.optionsOther[tempKey] = StructNew()> | |
| <cfset j.optionsOther[tempKey].name = tempName> | |
| <cfset j.optionsOther[tempKey].value = trim(getOptionsOther.varValue)> | |
| </cfloop> | |
| <cfset json = '{"optionsOther":' & jUtil.serializeJSON(j.optionsOther) & '}'> |