How do I turn this:

data = ((1, '2011-01-01'), (2, '2011-01-02'), (1, '2011-01-15'), (3, '2011-02-01'))

into this:

{
    "item": [
     "1",
     "2",
     "1",
     "3",
    ],
    "settings": {
     "axisx": [
      "2011-01-01",
      "2011-01-02",
      "2011-01-15",
      "2011-02-01"
     ],
     "axisy": [
      "0",
      "100"
     ],
     "colour": "ff9900"
     }
}

Or rather, are there any helpful resources that I can read so that I would be able to produce that JSON output? So I know I need to 'transform' my data into the right data structure. After that is it as easy as json.dumps(data)

Thanks

Edit
Report