html - flask background passes a null to the front end
扔个三星炸死你
扔个三星炸死你 2017-06-22 11:51:24
0
1
928

The flask backend passes the value to the front-end javascript and passes a null, such as ['Global',null,0,0]. If you use str to pass it, it will be ['Global','null',0,0], yes What can I do?

扔个三星炸死你
扔个三星炸死你

reply all(1)
習慣沉默

In the standard JSON format, the null value is included.

Python’s JSON library can parse null values ​​normally.

https://docs.python.org/3/lib...

>>> import json
>>> json.dumps(['foo', {'bar': ('baz', None, 1.0, 2)}])
'["foo", {"bar": ["baz", null, 1.0, 2]}]'

will parse None to null.

And the front-end’s JSON.parse can handle null values ​​normally.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template