title: ColdFusion parsing JSON
body: <p>I have followed this Adobe Help/<a href="https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-functions/functions-c-d/DeserializeJSON.html" rel="noreferrer">DeserializeJSON</a> documentation but it's giving me errors like <strong>Error in custom script module</strong> or <strong>Element COLUMNS is undefined in CFDATA</strong>. Any help is much appreciated. The error comes from cfData. Doing anything with cfData will cause some kind of errors. Dumping cfData works fine though. It shows all the correct data. Below is my code:</p>
  
  <pre><code>&lt;cfhttp url="http://api.openweathermap.org/data/2.5/weather?zip=55101,us&amp;appid=44db6a862fba0b067b1930da0d769e98" method="get" &gt;
  &lt;!--- JSON data is sometimes distributed as a JavaScript function. 
  The following REReplace functions strip the function wrapper. ---&gt;
  &lt;cfset theData=REReplace(cfhttp.FileContent, "^\s*[[:word:]]*\s*\(\s*","")&gt; 
  &lt;cfset theData=REReplace(theData, "\s*\)\s*$", "")&gt; 
  &lt;!---&lt;cfdump var="#theData#" &gt;---&gt;
  &lt;!--- Test to make sure you have JSON data. ---&gt;
  &lt;cfif !IsJSON(theData)&gt; 
      &lt;h3&gt;The URL you requested does not provide valid JSON&lt;/h3&gt; 
  
      &lt;!--- If the data is in JSON format, deserialize it. ---&gt;
  &lt;cfelse&gt;   
      &lt;cfset cfData=DeserializeJSON(theData)&gt;
      &lt;cfdump var=#cfData# &gt;
      &lt;cfset colList=ArrayToList(cfData.COLUMNS)&gt; 
      &lt;cfset weatherIdx=ListFind(colList, "weather")&gt;
      &lt;cfset descriptionIdx=ListFind(colList, "description")&gt;
      &lt;!--- Now iterate through the DATA array and display the data. ---&gt;
      &lt;cfoutput&gt;
          &lt;cfloop index="i" from="1" to="#Arraylen(cfData.DATA)#"&gt;            
              &lt;h3&gt;Weather: #cfData[i][weatherIdx]#&lt;/h3&gt;
              &lt;h4&gt;Discription: #cfData[i][descriptionIdx]#&lt;/h4&gt;
          &lt;/cfloop&gt;       
      &lt;/cfoutput&gt; 
  &lt;/cfif&gt;
  </code></pre>