Home  >  Article  >  Backend Development  >  PHP receives json passed by Android and converts it to array problem, androidjson_PHP tutorial

PHP receives json passed by Android and converts it to array problem, androidjson_PHP tutorial

WBOY
WBOYOriginal
2016-07-12 08:51:241154browse

php receives the json passed by Android and converts it to an array. Problem, androidjson

process: Android splices a json format data and passes the value, php receives and converts it to an array json_decode takes the value

The json format is: {"goods":{"100075":{"content":"Haha"},"53":{"content":"Really"},"50":{"content ":"Is it"}}}

Because Android passes toString and will escape the ""

{"goods":{"100075":{"content":"Haha"},"53":{"content":"Really"}," 50":{"content":"Is it"}}}

So php needs to be transferred back to htmlspecialchars_decode() so that the resulting json_decode will be no problem.

Remember json_decode($arr,true); the second parameter is true

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1130482.htmlTechArticlephp receives the json passed by Android and converts it into an array problem, androidjson process: Android splices a json format data to pass the value, php Receive and convert it into an array json_decode. The value json format is:...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn