It's all here: https://mariadb.com/kb/en/dynamic-columns/
The dynamic columns are stored inside a real blob
column and inserted like that:
insert into data
values (data_id, user_id, COLUMN_CREATE(<dcolumn1>, <value1>, <dcolumn2>, <value2>, ...));
So you would not use json here, instead serialize the data this way:
$dynamic = array()
foreach($_POST['sports'] as $sport) {
$dynamicData[] = "'" . $sport . "'", TRUE;
}
$dynamicColumn = join(', ', $dynamicData);
Will generate something like
'hockey', TRUE, 'soccer', TRUE
To search all rows for ppl playing soccer:
... where COLUMN_GET(dynamic_blob, 'soccer' as soccer) = TRUE;