This is also more Python 3 compatible, as the json module in Python 3 is expecting text. Thanks Vinay Sajip for noticing it.