I have installed "Tigra" dynamic navigation menu, and now it will be necessary , that the menu structure can be generated dynamically from mysql.

The syntax (to be generated) required for DTML structure is like:
var MENU_ITEMS = [

   ['Level 0 Item 1', null, null,
      ['Level 1 Item 0', 'another.html'],
      ['Level 1 Item 1'],
      ['Level 1 Item 2'],
      ['Level 1 Item 3'],
The DB structure I use is Hierarchical data structure

The problem is, how to generate this code correctly dynamically. I have tried many kinds of while-loops, but I just can't get close tags "]," placed correctly

I hope you understood what I am trying to do,
Is there anybody who have any ideas to solve this problem?