我需要帮助来使用自定义模型构建嵌套类别数组 这是我的自定义模型
export class Component extends BeanStub implements IComponent<any> {
这是我的JSON响应,其中parent_id = 0是根类别,而根类别具有多级子类别
var parentId : String //Contains parent categories
var categoryName : String //Contains category name
var categoryId : String //Contains category id
var childCategories : [CategoryModel] //Contains child categories belongs to parent category
init(parentId : String, categoryName : String, categoryId : String, childCategories : [CategoryModel])
{
self.parentId = parentId
self.categoryId = categoryId
self.categoryName = categoryName
self.childCategories = childCategories
}