[code.view]

[top] / python / PyMOTW / json / json_simple_types_decode.py

     #!/usr/bin/env python
     # encoding: utf-8
     #
     # Copyright (c) 2009 Doug Hellmann All rights reserved.
     #
     """
     """
     #end_pymotw_header
     
     import json
     
     data = [ { 'a':'A', 'b':(2, 4), 'c':3.0 } ]
     data_string = json.dumps(data)
     print 'ENCODED:', data_string
     
     decoded = json.loads(data_string)
     print 'DECODED:', decoded
     
     print 'ORIGINAL:', type(data[0]['b'])
     print 'DECODED :', type(decoded[0]['b'])

[top] / python / PyMOTW / json / json_simple_types_decode.py

contact | logmethods.com