I\'m just not a good enough computer scientist to figure this out by myself :(
I have an API that returns JSON responses that look like this:
// call to         
        
You could use this (a more compact and readable version)
def get_child_nodes(node_id):   
    request = urllib2.Request(ROOT_URL + node_id)
    response = json.loads(urllib2.urlopen(request).read())
    return {
       "id":response['id'],
       "name":response['name'],
       "children":map(lambda childId: get_child_nodes(childId), response['childNode'])
    }
get_child_nodes(ROOT_NODE)