Python的api如何识别json格式的数据的类型?


在用python的flask框架写一个api,但是得到的json数据都是unicode编码的,有些可能是int类型,要存进MySQL的话是只能自己写函数进行判断么?

restful python json api

铃木恵莉央 8 years, 11 months ago

这个你decode和encode一下就好了... 在py2中,还可以通过设置 setdefaultencoding utf-8 编码

三茎受 answered 8 years, 11 months ago

Your Answer