#-*- coding: utf-8 -*-
'''
Created on 2015年1月3日

@author: Guan-yu Willie Chen
'''

from collections import OrderedDict

import json

def sample():
    d = OrderedDict()
    d["foo"] = 1
    d["bar"] = 3
    d["spam"] = 4
    d["grok"] = 2
    
    return d

def sample1(dicts):
    for key in dicts:
        print(key, ":", dicts[key])
        
def sample2(dicts):
    print(json.dumps(dicts))

if __name__ == '__main__':
    print(sample())
    sample1(sample())
    sample2(sample())