我有一个数组包含JSON在一些索引,我有将其解码如何JSON解码的多维阵列
例如:
这是JSON
$json = {"Lavel1":"This is Lavel1","LavelLoop":"{\"Lavel2\":\"This is Lavel2\",\"LavelLoop\":\"{\\\"Lavel3\\\":\\\"This is Lavel3\\\",\\\"LavelLoop\\\":[]}\"}"}
如果是第一次解码,那么它给这个数组
$array = json_decode($json);
// this is the output
Array
(
[Lavel1] => This is Lavel1
[LavelLoop] => {"Lavel2":"This is Lavel2","LavelLoop":"{\"Lavel3\":\"This is Lavel3\",\"LavelLoop\":[]}"}
)
所以我有解码了三次,但我不能假设它有多少次JSON包含
欲望输出应该是这样的
Array
(
[Lavel1] => This is Lavel1
[LavelLoop] => Array
(
[Lavel2] => This is Lavel2
[LavelLoop] => Array
(
[Lavel3] => This is Lavel3
[LavelLoop] => Array
(
)
)
)
)
我试过循环,但它不工作,它给了我像一些索引显示错误n me empty
'$结果= json_decode( '<多维阵列>',TRUE);' – Haridarshan
你有没有尝试过,因为我知道这个功能,但JSON包含它自我一个子JSON – User97798
我已更新的问题看看 – User97798