I don’t know why you have created a model like this ModelCategories.
If I have to work on this I will create a model named Category as:
  public class Category {
       String id;
       String name;
       int position;
       List<Category> subCategories;
  }
8
solved how to get categories and subcategories with model classes from json