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?

4
  • Use json_decode method Commented Apr 13, 2017 at 5:21
  • @SahilGulati I know, but I was really urgent to get the answer. Commented Apr 13, 2017 at 5:22
  • Try to use post of @NishantNair Commented Apr 13, 2017 at 5:24
  • @MarshallS.Lee Please review stackoverflow.com/a/43384104/2667307 Commented Apr 13, 2017 at 5:27

2 Answers 2

5

Use json_decode

json_decode($your_jsonString,true)
Sign up to request clarification or add additional context in comments.

Comments

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
        )

)

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.