GridView dynamic number of columns

We want to move our api’s and backend application to Yii2 but I hit a wall regarding GridView.

Basically, I have a column in the database that is a serialized array and I cannot control how many array items are in there. The field is stored this way because it comes from multiple forms that are not controlled by us. So what I need is to create columns dynamically based on the number of array elements.

You can create the $columns definition dynamically and feed that to the gridview widget.