如何在php中进行json解码

时间:2017-02-27 05:52:16

标签: php json

如何在php中进行json解码

{
    TestID": 1,
    UserID": 1,
    TotalAttempted": 1,
    TotalQuestion": 1,
    LeftQuestion": 1,
    CorrectQuestion": 1,
    IncorrectQuestion": 1,
    TimeTaken": 1,
    "msg": [
        {
            "QuestionID": 5,
            "IsTrue": 1,
            "GivenAnswer": 1
        },
    ]
}

1 个答案:

答案 0 :(得分:2)

参考: - http://php.net/manual/en/function.json-decode.php

<?php
   $array = json_decode($json_variable,true);
  echo "<pre/>";print_r($array);
?>

注意: - 您的json数据有一些错过"

有效json的示例 : - https://eval.in/743659