-2

How to json decode in php

{
    TestID": 1,
    UserID": 1,
    TotalAttempted": 1,
    TotalQuestion": 1,
    LeftQuestion": 1,
    CorrectQuestion": 1,
    IncorrectQuestion": 1,
    TimeTaken": 1,
    "msg": [
        {
            "QuestionID": 5,
            "IsTrue": 1,
            "GivenAnswer": 1
        },
    ]
}
Alive to die - Anant
  • 70,531
  • 10
  • 51
  • 98

1 Answers1

2

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

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

Note:- Your json data have some missed ".

Example with a valid json:-https://eval.in/743659

Alive to die - Anant
  • 70,531
  • 10
  • 51
  • 98