True, I can always convert from bytes to str or vise versa. Sometimes it is illustrative to see how others have chosen to solve the same problem. The JSON specification and other implementations serializes an object to a string. Python's json.dumps() needs to either return a str or let the user specify an encoding.
On Mon, Apr 13, 2009 at 12:19 PM, "Martin v. Löwis" <firstname.lastname@example.org>
> I use the json module in 2.6 to communicate with a C# JSON library and aI assume there is a TCP connection between the json module and the
> consume the equivalent of str, not the equivalent of bytes.
Yes, there's a TCP connection. Sorry for not making that clear to begin with.
I also sometimes store JSON objects in a database. In that case, I pass strings to the database API which stores them in a TEXT field. Obviously somewhere they get encoding to bytes, but that's handled by the database.
If so, it doesn't matter what representation these implementations chose