title: How to generate json using Jinja2 Template Engine
body: <p>I am trying to generate a json file from a .xlsx file. </p>
  
  <p>so far I was able to get data from the file but I am not sure how to put them on json using jinja2. There is a problem in template structure. How can I solve this?</p>
  
  <p>Output should be like this</p>
  
  <pre><code>  "Matches": {    
      "1": {
        "time": "19:00",
        "teams": "Team 1 - Team 2"
      },
      "2": {
        "time": "21:00",
        "teams": "Team 3 - Team 4"
      },
      ...
      ...
      ...
    }
  </code></pre>
  
  <p>My code is something like this. Obviously template section is wrong.</p>
  
  <pre><code>from openpyxl import load_workbook
  from jinja2 import Template
  
  
  start_coloumn_of_matches = 3
  end_coloumn_of_matches = 20
  
  wb = load_workbook(filename = 'myfile.xlsx')
  sheet_ranges = wb['Sheet1']
  
  keys = []
  teams = []
  times = []
  
  
  for x in range(start_coloumn_of_matches, end_coloumn_of_matches + 1):
      team_column = 'A' + str(x)
      time_column = 'D' + str(x)
      teams.append(sheet_ranges[team_column].value)
      times.append(sheet_ranges[time_column].value)
      keys.append(x)
  
  
  
  template = Template(''' 
  "Matches": {
          {% for key in keys %}
        "{{key}}": 
          {% endfor %}
        {
          {% for team in teams %}
          "teams": "{{team}}",
          {% endfor %}
          {% for time in times %}
          "time": "{{time}}"
          {% endfor %}
          }
  
      }, 
  
      ''' )
  
  print(template.render(teams = teams, times = times, keys = keys))
  </code></pre>