I have a Class

```
class ListOfControllers
{
public:
    ListOfControllers();        
    ~ListOfControllers();    
    QList<RmgController> rmgControllers;

    QJsonObject toJson() const;
    void fromJson(QJsonObject obj);
};

```

In `fromJson` I want to read a json and fill the `QList<RmgController> rmgControllers`:

```
void ListOfControllers::fromJson(QJsonObject obj)
{
    .
    .
    .
            rmgControllers.clear();
            for (...)
            {
                RmgController rmg;
                rmg.fillWithValues();//fill the object with values from json
                rmgControllers.push_back(rmg);
                //at this point the DESTRUCTOR of RmgController is being called and the filled values CLEARED
            }
}

```

when I leave the scope of object creation the destructor of RmgController raises and clear all the filled values so the List (rmgControllers) contains some objects with default values not the values being read from json.