The difference is that json.dumps
applies some minor pretty-printing by default but JSON.stringify
does not.
To remove all whitespace, like JSON.stringify
, you need to specify the separators.
json_mylist = json.dumps(mylist, separators=(',', ':'))
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…