Handle both json and simplejson in unit tests

The simplejson and the json modules differ in the way they handle
trailing whitespace when indent is set.

  >>> json.dumps({"foo":[1,2]}, indent=2)
  '{\n  "foo": [\n    1, \n    2\n  ]\n}'

  >>> simplejson.dumps({"foo":[1,2]}, indent=2)
  '{\n  "foo": [\n    1,\n    2\n  ]\n}'

With this change, the unit tests use the same json implementation as the
tested code instead of hardcoding the expected json string in this
situation.