0
{
  "receiver_uid":[
          "58a43a3e3fbbf3.61108490",
          "58a43be07a3bc3.90311110",
          "58da53ab5ce8d6.84754819"
  ]
}

This is the value I would like to convert to array. I know it's quite a simple question, but please can anyone help me?

marmeladze
  • 6,468
  • 3
  • 24
  • 45
marshallslee
  • 645
  • 1
  • 8
  • 22

2 Answers2

5

Use json_decode

json_decode($your_jsonString,true)
Nishant Nair
  • 1,999
  • 1
  • 13
  • 18
4

You should use json_decode.

Try this:

$data = json_decode($your_json_string, TRUE);

The second parameter will make decoded json string into an associative arrays.

Example :-

$data = '{"receiver_uid":["58a43a3e3fbbf3.61108490","58a43be07a3bc3.90311110","58da53ab5ce8d6.84754819"]}';
$array = json_decode($data, true);
echo "<pre>";
print_r($array);

Output would be like

Array
(
    [receiver_uid] => Array
        (
            [0] => 58a43a3e3fbbf3.61108490
            [1] => 58a43be07a3bc3.90311110
            [2] => 58da53ab5ce8d6.84754819
        )

)
Shashank Shah
  • 2,077
  • 4
  • 22
  • 46