0

I want to change this

    {"success":true,"data":{"transactionid":"83ad87ef-711a-4123-8273-92684daab934","messageid":"U3HuUCokq0PzvH0L7cIWiQ2"}}
{"success":true,"data":{"transactionid":"83ad87ef-711a-4123-8273-92684daab934","messageid":"U3HuUCokq0PzvH0L7cIWiQ2"}}

Into array using PHP... Please guide..

Asad Ali Khan
  • 307
  • 4
  • 16

2 Answers2

1

Follow this link:

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

I hope it helps you.

Blauharley
  • 4,186
  • 6
  • 28
  • 47
Shailesh Chauhan
  • 673
  • 5
  • 20
1

Convert you json into array using json_decode() function with second parameter as true.Like this..

$json = '{"success":true,"data":{"transactionid":"83ad87ef-711a-4123-8273-92684daab934","messageid":"U3HuUCokq0PzvH0L7cIWiQ2"}}';
$array = json_decode($json,true);

print_r($array);

Output

Array
(
    [success] => 1
    [data] => Array
        (
            [transactionid] => 83ad87ef-711a-4123-8273-92684daab934
            [messageid] => U3HuUCokq0PzvH0L7cIWiQ2
        )

)

For more see docs json_decode()

Hikmat Sijapati
  • 6,869
  • 1
  • 9
  • 19