def get_post_json(post):

    post_json = post.getJsonObj()

    comment_list = []
    comments = Comment.getCommentsForPost(post)
    for comment in comments:
        comment_list.append(comment.getJsonObj())

    category_list = []
    categories = PostCategory.getCategoryForPost(post)
    if categories is not None:
        for category in categories:
            category_list.append(category.name)

    post_json['comments'] = comment_list
    post_json['categories'] = category_list

    return post_json
def get_post_json(post):

    post_json = post.getJsonObj()

    comment_list = []
    comments = Comment.getCommentsForPost(post)
    for comment in comments:
        comment_list.append(comment.getJsonObj())

    category_list = []
    categories = PostCategory.getCategoryForPost(post)
    if categories is not None:
        for category in categories:
            category_list.append(category.name)

    post_json['comments'] = comment_list
    post_json['categories'] = category_list

    return post_json