On 15Sep2019 09:15, Hongyi Zhao <hongyi.z...@gmail.com> wrote:
var = True

when json.dumps on it, it will become the form `true'

Why?

Because that's how the true value is spelt in JavaScript. You _are_ aware that JSON is "JavaScript Object Notation", are you not? So json.dumps translates Python values into JavaScript syntax.

This is likely to be the same reason you were wondering about None vs null; broadly, the Python None value serves the same purpose as the JavaScript null value, and therefore that is how it is expressed in JSON.

Cheers,
Cameron Simpson <c...@cskk.id.au>
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to