import json
aItem = {}
aItem["one"] = 1
aItem["two"] = 2
aItem["three"] = 3
aItem["four"] = "a"
aItem["five"] ="b"
aJson = json.dumps(aItem)
print aJson
输出
{"four": "a", "three": 3, "five": "b", "two": 2, "one": 1}
import json
aItem = {}
aItem["one"] = 1
aItem["two"] = 2
aItem["three"] = 3
aItem["four"] = "a"
aItem["five"] ="b"
aItem["six"] = {"c1":"c1","c2":"c2"}
aJson = json.dumps(aItem)
print aJson
输出:
{"six": {"c2": "c2", "c1": "c1"}, "three": 3, "two": 2, "four": "a", "five": "b", "one": 1}
网友评论