Dynamic creation of grid using DHTMLX Touch

I am planning to make a dynamic grid as a component of my final year project. User will give number of columns and header of columns. After he selects “ok”, grid will be created.
I have successfully created a static table and performed all operations on them. But I am unable to create a dynamic table.
While creating a static table I created a .json file. But now in case of dynamic table how to create .JSON file dynamically since number of columns and column headers wont be fixed.
Any help will be appreciated.

Thank you.

You can use some kind of server side script, which will generate data and output it as json string.
While output is valid it doesn’t matter is it produced from static json file, or some kind of dynamic script.