Simply use the methods described above. The json.dump and json.dumps functions accept both dictionaries and lists