Here is one example where json and simplejson and regular old json are not the same. How many types were tested for equivalence?
#!/usr/bin/env python
import collections import simplejson import json
PortInfo = collections.namedtuple("PortInfo", "mac_address ip_address")
pi = PortInfo('ca:fe:de:ad:be:ef', '192.168.1.1')
print json.dumps(pi) print simplejson.dumps(pi)
This prints: ["ca:fe:de:ad:be:ef", "192.168.1.1"] {"ip_address": "192.168.1.1", "mac_address": "ca:fe:de:ad:be:ef"}
Here is one example where json and simplejson and regular old json are not the same. How many types were tested for equivalence?
#!/usr/bin/env python
import collections
import simplejson
import json
PortInfo = collections. namedtuple( "PortInfo" , "mac_address ip_address")
pi = PortInfo( 'ca:fe: de:ad:be: ef', '192.168.1.1')
print json.dumps(pi) dumps(pi)
print simplejson.
This prints: de:ad:be: ef", "192.168.1.1"] de:ad:be: ef"}
["ca:fe:
{"ip_address": "192.168.1.1", "mac_address": "ca:fe: