I am creating a JSON using Python. It looks something like this:
[
...
{"name":"John","is_active":true}
...
]
This is like a configuration JSON that I will be passing to a config file.
How can I insert true as a value.
I do not want ‘True’ or True
I want to insert lowercase true as a value.
2
Answers
This automatically converts the
True
totrue
etc.The
json
module automatically maps the Python valueTrue
to the JSON valuetrue
:For example,
The converse is also true: the JSON value
true
is parsed as the Python valueTrue
: