Replace json.JSONEncoder with json.dumps
Include non-ascii characters in tests.py
Clarify comments
  Add assertJSONStringsEqual helper method
  Add test to ensure that new lines do not appear in JSON output
Add get_json_as_bytes function
Generalize output to accept any file-like object rather than just stdout