Like this
>>> import json
>>> outputs = None
>>> json.dumps(outputs)
'null'
>>> type(json.dumps(outputs))
<class 'str'>
In the case of an array, it looks like this
>>> list = ["hoge", None]
>>> json.dumps(list)
'["hoge", null]'
>>> type(json.dumps(list))
<class 'str'>
Recommended Posts