converting json to string in python

后端 未结 2 757
不知归路
不知归路 2020-12-04 17:37

I did not explain my questions clearly at beginning. Try to use str() and json.dumps() when converting json to string in python.

&         


        
2条回答
  •  孤城傲影
    2020-12-04 17:47

    There are other differences. For instance, {'time': datetime.now()} cannot be serialized to JSON, but can be converted to string. You should use one of these tools depending on the purpose (i.e. will the result later be decoded).

提交回复
热议问题