內置模塊問題。
1、import json
from collections import OrderedDict
metadata = json.loads(text, object_pairs_hook=OrderedDict);
metadata中properties的順序是跟text中定義的順序是壹樣的。
具體可以看python文檔中json.loads函數中的參數
2、可以使用內置模塊 json
content = {"id": "evt_ugB6x3K43D16wXCcqbplWAJo"}print content #{'id': 'evt_ugB6x3K43D16wXCcqbplWAJo'}import jsonprint json.dumps(content) #{"id": "evt_ugB6x3K43D16wXCcqbplWAJo"}print type(json.dumps(content)) #<type 'str'>。