I try to achieve the following using the default python encoder: { "x": { "name": "value" }, "x": [ { "other_name": "other_value" } ] } My current JSON skills allow the following import json data = {} data["x"] = {} data["x"]["name"] = "value" y = {} y["other_name"] = "other_value" data["x"] = [y] print(json.dumps(data)) which of course only results in { "x": [ { "other_name": "other_value" } ] } How can I get an output that contains a JSON object and an identically named array (here "x")? Continue reading...