-1

i'm having structure of json like given below

{
    "today": {
        "currencyCode": "USD",
        "value": 100
    },
    "yesterday": {
        "currencyCode": "USD",
        "value": 90
    }
}

and i want to convert it to multi-dimentional array in php like given below:-

Array
(
    [today] => Array
        (
            [currencyCode] => USD
            [value] => 100
        )

    [yesterday] => Array
        (
            [currencyCode] => USD
            [value] => 90
        )

)
1

1 Answer 1

1

like this,

    $json ='{
    "today": {
        "currencyCode": "USD",
        "value": 100
    },
    "yesterday": {
        "currencyCode": "USD",
        "value": 90
    }
}';

$data = json_decode($json, TRUE);


    var_dump($data);
Sign up to request clarification or add additional context in comments.

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.