<?php $response2_decoded = json_decode($response2, true); echo "<pre>"; // drill your way down and see what keys are available var_export(array_keys($response2_decoded)); echo "<br>"; var_export(array_keys($response2_decoded['profileChanges'])); echo "<br>"; var_export(array_keys($response2_decoded['profileChanges'][0])); // <-- needed this one echo "<br>"; var_export(array_keys($response2_decoded['profileChanges'][0]['profile'])); // <-- needed this one echo "<br>"; var_export(array_keys($response2_decoded['profileChanges'][0]['profile']['stats'])); echo "<br>"; var_export(array_keys($response2_decoded['profileChanges'][0]['profile']['stats']['attributes'])); echo "<br>"; var_export(array_keys($response2_decoded['profileChanges'][0]['profile']['stats']['attributes']['past_seasons'])); // found it, use it! echo "<br>"; // vvvvvvvv-- be careful of typos here foreach ($response2_decoded['profileChanges'][0]['profile']['stats']['attributes']['past_seasons'] as $set) { $array_seasons[] = ["season" => $set['seasonNumber'], "battle_pass" => $set['purchasedVIP']]; } echo json_encode(["seasons" => $array_seasons]);
You have javascript disabled. You will not be able to edit any code.