[英]jqgrid json data not working with json_decode
I have a json string that is posted to the server that looks like this: 我有一个发布到服务器的json字符串,如下所示:
{\"groupOp\":\"AND\",\"rules\":[{\"field\":\"screen_name\",\"op\":\"bw\",\"data\":\"aaa\"}]}
It looks pretty good to me, but the problem is the PHP function json_decode
returns NULL. 对我来说看起来不错,但是问题是PHP函数json_decode
返回NULL。 I made a codepad example that illustrates the problem here : http://codepad.org/SOJw9cZb . 我制作了一个键盘示例来说明此问题: http : //codepad.org/SOJw9cZb 。 What do I have to do to this string to get json_decode to work properly? 我必须对这个字符串做些什么才能使json_decode正常工作?
This json string is sent to the server by the jqgrid Filter Toolbar module to identify the search parameters. 该json字符串由jqgrid 筛选器工具栏模块发送到服务器,以标识搜索参数。
Thanks! 谢谢!
var_dump(json_decode(str_replace('\"', '"', '{\"groupOp\":\"AND\",\"rules\":[{\"field\":\"screen_name\",\"op\":\"bw\",\"data\":\"aaa\"}]}')));
works just fine. 效果很好。 ie convert the \\" to " 即将\\“转换为”
Valid JSON is 有效的JSON是
{"groupOp":"AND","rules":[{"field":"screen_name","op":"bw","data":"aaa"}]}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.