Is there a best-practice for outputting Booleans in Python? I’m generating some JSON (via Django templates), and by default all the Boolean values are output with leading character in uppercase, contrary to the JSON standard (ie, “True” as opposed to “true”).
Currently, I format each Boolean string using str.lower(), but is there a better way?
The way to do this is to not use templates. Use the json module, as so:
My preferred way is to write a decorator, and return a dict.