On python3, sys.stdin/stdout are Text-mode streams, which can be
approximated with io.StringIO. On python2, there's no real
distinction between Text-mode and Binary-mode (except for line
endings, which sys.stdin/stdout also treat as Text-mode). Hence,
there's no need to explicitly use io.BytesIO on python2.
StringIO.StringIO is equally or more representative of how the
mocked streams behave.
Therefore, just use six.StringIO instead of different types for
python2 vs. python3.
On python <3.4 the separator for json.dump() defaulted to (', ', ': ')
which may cause trailing whitespaces in rendered JSON files when used
with indent. This change sets the separator to (',', ': ') to prevent
trailing whitespaces with older versions of python.