【发布时间】:2021-08-26 13:17:56
【问题描述】:
"op=add&item={"firstName":"test","lastName":"test","email":"test%40test.com","password":"test"}"
我将上面的 JSON 正文传递给我的 PHP 后端,当尝试在其上使用 json_decode 时,结果为 null。我使用了 json_last_error() ,它指出存在语法问题。使用 jsonlint.com,它给了我这个错误:
Error: Parse error on line 1:
"op=add&item={"firstName ":"test "
---------------^
Expecting 'EOF', '}', ':', ',', ']', got 'undefined'
我已尝试解决此错误,但未能获得成功的响应。有人能描述一下问题可能是什么吗?
【问题讨论】:
-
你在做什么
json_decode()?代码真的很有用,因为我们都是程序员。该字符串的唯一 JSON 部分是{"firstName":"test","lastName":"test","email":"test%40test.com","password":"test"}位,它解释了错误
标签: php json jsondecoder