将Json对象从php文件发送到python文件


Sending Json Object from a php file to a python file?

我想知道,是否可以将php(zend控制器操作)文件中编码的json对象发送到python文件?python中是否有任何函数可以解码php编码的json对象?如果有,请在这里张贴您的回复。。感谢

您可以在python中使用RAW字符串标识符(r)。像这样的东西会起作用:

# Python 2.6.2
>>> import simplejson as json
>>> s = r'{"a":{"a1":"{'"foo'":'"bar'",'"foo1'":'"bar1'"}"}}'
>>> json.loads(s)
{u'a': {u'a1': u'{"foo":"bar","foo1":"bar1"}'}}