'Parse one JSON object of a category (and its subcategories) to Category
:param json_category: dict
:return:'

def map_category(self, json_category):

    if ((json_category.get(u'id') is None) or (json_category.get(u'pid') is None) or (json_category.get(u'name') is None)):
        return None
    mapped_category = Category()
    mapped_category.id = int(json_category.get(u'id'))
    pid = int(json_category.get(u'pid'))
    if (pid == 0):
        mapped_category.parent_id = None
    else:
        mapped_category.parent_id = pid
    mapped_category.name = json_category.get(u'name')
    json_sub_categories = json_category.get(u'cats')
    if (json_sub_categories is not None):
        for json_sub_category in json_sub_categories.values():
            mapped_sub_category = self.map_category(json_sub_category)
            mapped_category.sub_categories.append(mapped_sub_category)
    return mapped_category
