Answer the question
In order to leave comments, you need to log in
How to parse JSON in a loop?
{
"serial": {
"title_ru": "Во все тяжкие",
"title_en": "Breaking Bad",
"token": "ac68ccf3ec244f3f6980816b9a27cc36",
"type": "serial",
"kinopoisk_id": 404900,
"translator": "LostFilm",
"translator_id": 2,
"last_episode_time": "2014-03-26 22:29:34",
"iframe_url": "http://moonwalk.cc/serial/ac68ccf3ec244f3f6980816b9a27cc36/iframe"
},
"season_episodes_count": [
{
"season_number": 1,
"episodes_count": 7
},
{
"season_number": 2,
"episodes_count": 13
},
{
"season_number": 3,
"episodes_count": 13
},
{
"season_number": 4,
"episodes_count": 13
},
{
"season_number": 5,
"episodes_count": 16
}
]
}
Answer the question
In order to leave comments, you need to log in
It's not entirely clear what you wanted there, but this is how you can run through the season_episodes_count.
$json = json_decode("тут жсон", true);
foreach ($json['season_episodes_count'] as $season) {
// $season -> ['season_number' => X, 'episodes_count' => Y]
// делай с этим что хочешь
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question