print_r($json); Gives me:
{ "items_game": { "game_info": { "first_valid_class": "1", "last_valid_class": "1000", "first_valid_item_slot": "0", "last_valid_item_slot": "15", "num_item_presets": "4" }, "rarities": { "common": { "value": "1", "loc_key": "Rarity_Common", "color": "desc_common", "next_rarity": "uncommon" }, "uncommon": { "value": "2", "loc_key": "Rarity_Uncommon", "color": "desc_uncommon", "next_rarity": "rare" }, "rare": { "value": "3", "loc_key": "Rarity_Rare", "color": "desc_rare", "next_rarity": "mythical" }, Is it possible to get from this array only the values "value" and "color"? If possible, please tell me how ... I'm trying to do it through
foreach($json['items_game'] as $key => $item) { echo $item['value']; } But I immediately get two errors, I tried to change, but nothing is lost:
llegal string offset 'items_game' invalid argument supplied for foreach()
json_decode. All is parsed instdClass, from here errors. To convert to an array, set the second argument of the function totrue. And give an example of what you need to get in the end, but it is somehow unclear. - user207618json_decodedoes not display anything because apparently json is not valid .. if it is such as in the question, then 100% is invalid. - Alexey Shimansky&format=json, and do not torture people. - Bookin