Python2.4.3に simplejsonをインストールする
PythonでJSONを使いたいな〜〜〜と思ったのですが、PythonでのJSONの標準サポートは2.6からで、現在インストールしているPythonがバージョン2.4.3のため
simplejsonのサイトからsimplejsonをダウンロードしてインストールする。
wget http://pypi.python.org/packages/source/s/simplejson/simplejson-2.1.2.tar.gz#md5=a856f9ae9ab3749991a93ddeafadc554 tar -xvzf simplejson-2.1.2.tar.gz cd simplejson-2.1.2 python setup.py install
# python Python 2.4.3 (#1, Jun 18 2012, 08:55:31) [GCC 4.1.2 20080704 (Red Hat 4.1.2-52)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import simplejson >>> print simplejson.dumps({"item":[{ "name": "山田", "age": 21 },{ "name": "佐藤", "age": 56 },{ "name": "鈴木", "age": 33 }]}, sort_keys=True, indent=4) { "item": [ { "age": 21, "name": "\u5c71\u7530" }, { "age": 56, "name": "\u4f50\u85e4" }, { "age": 33, "name": "\u9234\u6728" } ] } >>>