import json str = { "東京":{ "population": 1300, "capital": "東京" }, "北海道": { "population": 538, "capital": "札幌市" }, "沖縄":{ "population": 143, "capital": "那覇市" } } with open("population.json", "w") as f: json.dump(str, f, ensure_ascii=False)
{“東京”: {“population”: 1300, “capital”: “東京”}, “北海道”: {“population”: 538, “capital”: “札幌市”}, “沖縄”: {“population”: 143, “capital”: “那覇市”}}
なるほどー