1

I'm Developing a site the involves Steam API and i'm having a hard time in this part on how to fetch the data by using there ID in json.

This is the Code that i use :

<?php
$item_details = json_decode(file_get_contents("items_game1.json"));
echo $item_details->result->20595[0]->name;
?>

If its variable I can retrieve it without any problem but as we can see this "20595" is what i need in order to fetch each Data

Here is the Sample json code im using

{
"items_game"; {
    "items":{
        "20595": {
                    "name": "Firestarter",
                    "prefab": "bundle",
                    "bundle": {
                        "Flame Bat": "1",
                            "Firestarter Gas Mask": "1",
                            "Firestarter Fuel Cannister": "1",
                            "Firestarter Gas Pump": "1",
                        "Firestarter Loading Screen": "1"
                    },
                    "creation_date": "2014-07-21",
                    "image_inventory": "econ/sets/DOTA_Item_Firestarter",
                    "item_description": "#DOTA_Item_Desc_Firestarter",
                    "item_name": "#DOTA_Item_Firestarter",
                    "item_rarity": "rare",
                    "used_by_heroes": {
                            "npc_dota_hero_batrider": "1"
                    }
        }}

Please take note the json file i'm using is provided by Steam

Link of the whole code in VDF that i converted to json Click Here

I hope someone can help me. Thanks ! Have a nice day

Frosty3390
  • 11
  • 2

0 Answers0