-4

i have a json array like below,

{
    "months": {
        "1": ["1"],
        "2": ["10"]
    },
    "days": {
        "1": ["1", "2"],
        "2": ["2", "3"]
    }
}

i need to parse this in php. Need months and days values. Thanks in advance..

raja ks
  • 25
  • 6

1 Answers1

-1

why you don't use json_decode() function?

$json = '{
"months": {
    "1": ["1"],
    "2": ["10"]
},
"days": {
    "1": ["1", "2"],
    "2": ["2", "3"]
}
}';

$decoded = json_decode($json);
var_dump($decoded);
MaZaN
  • 107
  • 10