Comment 63 for bug 1314129

Revision history for this message
Carl Baldwin (carl-baldwin) wrote :

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"}