What is a more concise way to convert python boolean to javascript boolean literals?

I want to convert python boolean to a JS boolean literal. This is what I work with:

store = dict(vat=True)

if store['vat']:
    store.update({'vat': 'true'})
else:
    store.update({'vat': 'false'})

Is there a more or less correct way to replace this piece of code?

+5
source share
2 answers
>>> store['vat'] = json.dumps(store['vat'])
>>> store
{'vat': 'true'}
+15
source

In JS, a positive integer value is truly true, and 0 (zero) is false.

You can try passing 0 as JS false and 1 as JS true (do not use negative values)

>1 == true
true
>0 == true
false
>0 == false
true
>1 == false
false
0
source