python save list to json

JavaScript
import json
with open('data.json', 'w') as f:
    json.dump(data, f)

Source

Also in JavaScript: