title: passing python list to javascript
body: <p>I am trying to pass a python list to a javascript function, but it doesn't work... I think the Javascript function will see it as one long string. This is what I do:</p>
  
  <pre><code>@webiopi.macro
  def calcSunriseSunsetOneYear():
      o=ephem.Observer()
      o.lat='51.21828'
      o.long='3.94958'
      s=ephem.Sun()
      d=datetime.date.today()
  
      t=timedelta(days=1)
      d=d+t
      o.date=d
  
      riseTime=[]
      setTime=[]
      s.compute()
      for x in range (0,365):
          o.date=o.date+1
          riseTime.append(str(ephem.localtime(o.next_rising(s))))
          setTime.append(str(ephem.localtime(o.next_setting(s))))
      return(json.dumps(riseTime))
  </code></pre>
  
  <p>This is the python data:</p>
  
  <pre><code>["2015-03-22 06:43:02.000006", "2015-03-23 06:40:46", "2015-03-24 06:38:31.000001", "2015-03-25 06:36:15.000002", "2015-03-26 06:33:59.000003", "2015-03-27 06:31:44.000004", "2015-03-28 06:29:28.000005", "2015-03-29 07:27:13.000006", "2015-03-30 07:24:57", "2015-03-31 07:22:42.000001", "2015-04-01 07:20:27.000002", "2015-04-02 07:18:13.000003", "2015-04-03 07:15:58.000004", "2015-04-04 07:13:44.000005", "2015-04-05 07:11:31.000006", "2015-04-06 07:09:17", "2015-04-07 07:07:04.000001", "2015-04-08 07:04:52.000002", "2015-04-09 07:02:40.000003", "2015-04-10 07:00:28.000004"]
  </code></pre>
  
  <p>In Javascript I do this:</p>
  
  <pre><code>var printChart = function macroCallBack(macro, args, chartInfo) {
          document.getElementById("chartInfo").innerHTML=chartInfo;
          var arLength=chartInfo.length;
          console.log("arLength is: ",arLength);
          for (var i=0; i&lt;arLength; i++) {
              console.log(chartInfo[i]);
          }
      }
  </code></pre>
  
  <p>And the console prints every character of the python list on a seperate line, like this:</p>
  
  <p>[
  "
  2
  0
  1
  5
  etc...</p>
  
  <p>I can't format the above console.log output, but every character is on a seperate line.</p>
  
  <p>Also the length of the array is exactly the same as the length of the total string, so my conclusion is the python list is transformed to Javascript as one long string...</p>
  
  <p>I hope someone can help me out!</p>