Adding a child node to a JSON node dynamically
- by Sai
I have to create a nested multi level json depending on the resultset that I get from MYSQL. I created a json object initially. Now I want to add child nodes to the already child nodes in the object. 
d = collections.OrderedDict()                                                           
jsonobj = {"test": dict(updated_at="today", ID="ID", ads=[])}       
for rows1 in rs:                                                                        
    jsonobj['list']["ads"].append(dict(unit = "1",                           
                                        type ="ad_type",                         
                                        id ="123",                         
                                        updated_at="today",                
                                        x_id="111",                          
                                        x_name="test"))                      
cur.execute("SELECT * from f_test")                                      
rs1 = cur.fetchall()                                                                
for rows2 in rs1:                                                                   
   propertiesObj = []                                                               
   d["name"]="propName"                                                             
   d["type"]="TypeName"                                                             
   d["value"]="Value1"                                                              
   propertiesObj.append(d)                                                          
   jsonobj['play_list']["ads"].append()
Here in the above line I want to add another child node to [play_list].[ads] which is a array list again.  
the output should look like the following [list].[ads].[preferences].