In `Python`, I'm trying to take an `XML` file, process it, then output the data to a `JSON`. The XML processing works fine, but I am having trouble properly formatting the JSON. The output file looks more like a list with dictionaries inside of it, which makes sense because that's what the code actually does. How can I make this a proper JSON file?

```
filename = 'data.json'

d = []

for elem in ET.fromstring(data).findall('.//table/row'):
        field1 = elem.get('field1')
        field2 = elem.get('field2')
        field3 = elem.get('field3')
        field4 = elem.get('field4')
        l = {'field1' : field1, 
             'field2' : field2, 
             'field3' : field3, 
             'field4' : field4}
        d.append(l)

f_out = open(filename, 'w')
json.dump(d, f_out)

f_out.close()

```

The output file looks like this:

```
[{"field1": "field1", "field2": "field2", "field3": "field3", "field4": "field4"}, ... {"field1": "field1", "field2": "field2", "field3": "field3", "field4": "field4"}]

```

When I would expect it to look like:

```
{"field1": "field1", "field2": "field2", "field3": "field3", "field4": "field4"}, ... {"field1": "field1", "field2": "field2", "field3": "field3", "field4": "field4"}

```