Split out your key-value pairs into separate dictionaries:
json.dumps([{'file_name': key, 'file_information': value} for key, value in yourdict.iteritems()])
Note that the order of your output will be arbitrary (dictionaries have no fixed ordering). You may want to sort the output to produce a predictable list:
from operator import itemgetter
data = [{'file_name': key, 'file_information': value} for key, value in yourdict.iteritems()]
data.sort(key=itemgetter('file_name'))
json.dumps(data)
This produces:
>>> data = [{'file_name': key, 'file_information': value} for key, value in yourdict.iteritems()]
>>> data.sort(key=itemgetter('file_name'))
>>> json.dumps(data)
'[{"file_name": "20090209.02s1.1_sequence.txt", "file_information": [645045714, 3559.6422951221466, 206045184]}, {"file_name": "20090209.02s1.2_sequence.txt", "file_information": [645045714, 3543.8322949409485, 234618880]}]'
>>> print json.dumps(data, indent=4)
[
{
"file_name": "20090209.02s1.1_sequence.txt",
"file_information": [
645045714,
3559.6422951221466,
206045184
]
},
{
"file_name": "20090209.02s1.2_sequence.txt",
"file_information": [
645045714,
3543.8322949409485,
234618880
]
}
]