title: How to nest json in python?
body: <p>I'm working on django app and need to pass data from django sql as json to javascript. I'm struggling with nesting one thing. I was able to nest one level but I can't nest second level. While nesting second level, json replaces the value according to itteration instead of appending it. My goal it to obtain the the following effect: </p>
  
  <p>date > [time1 > [1,2,3], time2 > [1,2,3]], date2 > [time1 > [1,2,3]] etc..</p>
  
  <p>At this moment i can't nest more than one time :( Appreciate for help !</p>
  
  <pre><code>reserved = Reservation.objects.get(customer=user_info)
          for x in reserved.reservations.all():
              title = x.movie.title
              image = x.movie.image
              date = str(x.date)
              time = str(x.time)
              dates = {date:{}}
              times = {time:{}}
              if title in dic:
                  pass
              else:
                  dic[title] = {"image":str(image), "dates":{}}
              for y in x.seats.all():
                  seats = {y.row:y.number}
                  times[time].update(seats)
              dates[date].update(times)
              dic[title]["dates"].update(dates)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/hzVvm.jpg" rel="nofollow noreferrer">CURRENT RESULT</a></p>