title: How to create JSON from cfquery?
body: <p>Here is my query that I put in JSON and after that store information in the table. When I checked results in the table I saw that output does not give me what i actually wanted. My idea is to get all dates in between each start and end date. My code gave me just end dates. Here is my code: </p>
  
  <pre><code>//Here is my query 
  &lt;cfquery name="myQuery" datasource="test"&gt;
      Select UserID, UserEmail, PickDateTime, DropDateTime
      From UserInfo
      Order by PickDateTime
  &lt;/cfquery&gt;
  
  //This is my JSON 
  &lt;script&gt;
      myJSON = {
      &lt;cfoutput query="myQuery"&gt;
          &lt;cfloop from="#PickDateTime#" to="#DropDateTime#" index="i" step="#CreateTimeSpan(1,0,0,0)#"&gt;
             "#currentrow#":{"ID":"#UserID#","date":"#dateformat(i,'mmddyyyy')#","email":"#UserEmail#"},  
          &lt;/cfloop&gt;
      &lt;/cfoutput&gt;
      }
  
  //Here is my function that creates the table
  function getData(){
      myVar="&lt;table&gt;&lt;tr&gt;&lt;td&gt;ID&lt;/td&gt;&lt;td&gt;Date&lt;/td&gt;&lt;td&gt;Email&lt;/td&gt;&lt;/tr&gt;&lt;tbody&gt;"
      for(key in myJSON){
          myVar+=
              "&lt;tr&gt;"+
              "&lt;td&gt;"+myJSON[key].ID+"&lt;/td&gt;"+
              "&lt;td&gt;"+myJSON[key].date+"&lt;/td&gt;"+
              "&lt;td&gt;"+myJSON[key].email+"&lt;/td&gt;"+
              "&lt;/tr&gt;"
      }
      myVar+="&lt;/tbody&gt;&lt;/table&gt;"
      document.getElementById('myTable').innerHTML = myVar    
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>and here is my html:</p>
  
  <pre><code>&lt;div id='myTable'&gt;&lt;/div&gt;
  </code></pre>
  
  <p>Here is my table with current output:</p>
  
  <pre><code>ID   Date          Email
  1   01092016    example@gmail.com
  2   01112016    example@gmail.com
  3   01132016    example@gmail.com
  3   01162016    example@gmail.com
  4   01182016    example@gmail.com
  5   01192016    example@gmail.com
  </code></pre>
  
  <p>As you can see in my output I'm just getting End dates but I do not get dates in between. I should get all dates from start to end date. If my start date is 01/20/2015 and my end date is 01/24/2015 I want to have dates in between. I'm not sure if my JSON is created properly or something is wrong in my cfloop. If anyone can help with this problem please let me know.</p>