code: def as_tree(context):
      
  
      tree = _build_tree(context, 2, 1)
      if type(tree) == dict:
          tree = [tree] 
      
      return Response(content_type='application/json', body=json.dumps(tree))
docs: Return info about an object's members as JSON