title: Creating a json output out of arrays in arrays
body: <p>I am struggling with the following python issue. I want to create a json output from existing lists, but its a 3-level structure that I cannot realize.</p>
  
  <p>I know how to create a 2-level structure:</p>
  
  <pre><code>data = json.dumps(
      [ {'book_id': i, 'exam': [{'count': k, 'wordids': w}]} \
          for k,i,w, in \
          zip(examcounts, bookid_list, wordid_list)],
      indent=4)
  </code></pre>
  
  <p>which produces a valid 2-level structure, but I need to somehow implement another for loop into this, I just couldn't figure it out how.</p>
  
  <p>So the wished output should look like:</p>
  
  <pre><code>[
      {
          "book_id": "a",
          "exams": [
              {
                  "exam": [
                      {
                          "result":"B"
                          "wordids": [
                              25201L,
                              41851L,
                              10134L
                          ]
                      }
                  ],
                  "exam": [
                      {
                          "result":"A"
                          "wordids": [
                              43,
                              41,
                              10
                          ]
                      }
                  ]
               }
           ]
       },
       {
          "book_id": "b",
          "exams": [
              {
                  "exam": [
                      {
                          "result":"C"
                          "wordids": [
                              25,
                              10
                          ]
                      }
                  ],
                  "exam": [
                      {
                          "result":"C"
                          "wordids": [
                              25,
                              10
                          ]
                      }
                  ],
                  "exam": [
                      {
                          "result":"F"
                          "wordids": [
                              43,
                              41,
                          ]
                      }
                  ]
               }
           ]
       }
  ]
  </code></pre>
  
  <p>list examples:</p>
  
  <pre><code>bookid_list: [u'a', u'b']
  exmcounts: [22, 22, 20, 21, 21, 21, 21, 18]
  results: ['B','A','C','C','F'...] with 8 length
  wordid_list: [[25201L, 41851L, 10134L, 12174L, 6899L, 26078L, 12457L, 12176L, 26056L, 9451L, 25164L, 6618L, 43482L, 18681L, 12370L, 43272L, 15561L, 43483L, 30121L, 7715L, 21111L, 9461L], [13822L, 5172L, 7176L, 25754L, 12372L, 5509L, 16712L, 6187L, 8263L, 15408L, 20262L, 43487L, 5143L, 43488L, 6145L, 5697L, 7581L, 43489L, 22538L, 19417L, 43491L, 21498L], [19475L, 11631L, 12172L, 19495L, 30396L, 37274L, 43493L, 32393L, 5945L, 37521L, 6956L, 43494L, 36517L, 43495L, 13255L, 6558L, 12867L, 13382L, 6489L, 15447L]]
  </code></pre>
  
  <p>(The wordid list has a length of 8, and each item has length of 22, 22, 20, 21..)
  Big thanks in advance!</p>