在PHP中将带有特殊字符的JSON解析为数组

在PHP中将带有特殊字符的JSON解析为数组,php,json,parsing,toarray,Php,Json,Parsing,Toarray,注意:上面是json编码的,但即使使用json_decode()解码json,也无法将其作为数组访问 输出: 信用额度:450万 通过上述方法找到了解决方案。请将您的问题举例说明您运行的代码、预期输出和实际输出。“特殊字符”是什么意思?这是对象的JSON表示;它的属性api\u reponse的值是另一个JSON。为了使用它,你也必须这样做。 { "api_response": "{\"LeadRefNumber\":\"23223222433534543554\",\"Applicat

注意:上面是json编码的,但即使使用json_decode()解码json,也无法将其作为数组访问

输出:

信用额度:450万


通过上述方法找到了解决方案。

请将您的问题举例说明您运行的代码、预期输出和实际输出。“特殊字符”是什么意思?这是对象的JSON表示;它的属性
api\u reponse
的值是另一个JSON。为了使用它,你也必须这样做。
{
    "api_response": "{\"LeadRefNumber\":\"23223222433534543554\",\"ApplicationNumber\":\"2323343434234234\",\"StatusCode\":\"3456\",\"ProcessingStatus\":\"111\",\"CreditLimit\":\"5454554\",\"Messages\":{\"Message\":\"test.\"}}"
}
$creditLimit = {"api_response":"{\"LeadRefNumber\":\"3434343345435453\",\"ApplicationNumber\":\"5345345345345534\",\"StatusCode\":\"13420\",\"ProcessingStatus\":\"145\",\"CreditLimit\":\"4500000\",\"Messages\":{\"Message\":\"Test\"}}"};

$arrCreditLimit = json_decode($creditLimit['api_response'], true);

print_r("CreditLimit".$arrCreditLimit['CreditLimit']);