mardi 4 août 2015

Best way to get more than one value form Json?

I'm using bootstrap for my website, and in the center I need to display a series of item names with pictures. The name information I get form a Json that I request from a URL.

This is what the Json looks like

{
   "success": true,
   "rgInventory": {
      "3019159034": {
         "id": "3019159034",
         "classid": "469444882",
         "instanceid": "302028390",
         "amount": "1",
         "pos": 1
      },
      "3007405356": {
         "id": "3007405356",
         "classid": "520025252",
         "instanceid": "0",
         "amount": "1",
         "pos": 2
      }
   },
   "rgCurrency": [],
   "rgDescriptions": {
      "469444882_302028390": {
         "appid": "730",
         "classid": "469444882",
         "instanceid": "302028390",
         "icon_url": "-9a81dlWLwJ2UUGcVs_nsVtzdOEdtWwKGZZLQHTxDZ7I56KU0Zwwo4NUX4oFJZEHLbXH5ApeO4YmlhxYQknCRvCo04DEVlxkKgpoor-mcjhoyszMdS1D-OOjhoK0mvLwOq7c2D4B6pwijLiXpt6s3lDkrkJvZG-hLI7Ee1M7YVmC8gO-kunrjZK1tJXXiSw0uDynv1g",
         "icon_url_large": "-9a81dlWLwJ2UUGcVs_nsVtzdOEdtWwKGZZLQHTxDZ7I56KU0Zwwo4NUX4oFJZEHLbXH5ApeO4YmlhxYQknCRvCo04DEVlxkKgpoor-mcjhoyszMdS1D-OOjhoK0mvLwOq7cqWdQ-sJ0xLyR99WmjgXi-EFlZT3zcYeWdQBsaVCB8wS7we-9jcS875rNwXZqsig8pSGKg7HJkhk",
         "icon_drag_url": "",
         "name": "Tec-9 | Urban DDPAT",
         "market_hash_name": "Tec-9 | Urban DDPAT (Field-Tested)",
         "market_name": "Tec-9 | Urban DDPAT (Field-Tested)",
         "name_color": "D2D2D2",
         "background_color": "",
         "type": "Consumer Grade Pistol",
         "tradable": 1,
         "marketable": 1,
         "commodity": 0,
         "market_tradable_restriction": "7",
         "descriptions": [
            {
               "type": "html",
               "value": "Exterior: Field-Tested"
            },
            {
               "type": "html",
               "value": " "
            },
            {
               "type": "html",
               "value": "An ideal pistol for the Terrorist on the move, the Tec-9 is lethal in close quarters and features a high magazine capacity. It has been painted using a Digital Disruptive Pattern (DDPAT) hydrographic.\n\n<i>By the time you're close enough to notice the pixels it's already too late<\/i>"
            },
            {
               "type": "html",
               "value": " "
            },
            {
               "type": "html",
               "value": "The Bank Collection",
               "color": "9da1a9",
               "app_data": {
                  "def_index": "65535",
                  "is_itemset_name": 1
               }
            },
            {
               "type": "html",
               "value": " "
            }
         ],
         "actions": [
            {
               "name": "Inspect in Game...",
               "link": "http://steamrungame/730/76561202255233023/+csgo_econ_action_preview%20S%owner_steamid%A%assetid%D434632987144428496"
            }
         ],
         "market_actions": [
            {
               "name": "Inspect in Game...",
               "link": "http://steamrungame/730/76561202255233023/+csgo_econ_action_preview%20M%listingid%A%assetid%D434632987144428496"
            }
         ],
         "tags": [
            {
               "internal_name": "CSGO_Type_Pistol",
               "name": "Pistol",
               "category": "Type",
               "category_name": "Type"
            },
            {
               "internal_name": "weapon_tec9",
               "name": "Tec-9",
               "category": "Weapon",
               "category_name": "Weapon"
            },
            {
               "internal_name": "set_bank",
               "name": "The Bank Collection",
               "category": "ItemSet",
               "category_name": "Collection"
            },
            {
               "internal_name": "normal",
               "name": "Normal",
               "category": "Quality",
               "category_name": "Category"
            },
            {
               "internal_name": "Rarity_Common_Weapon",
               "name": "Consumer Grade",
               "category": "Rarity",
               "color": "b0c3d9",
               "category_name": "Quality"
            },
            {
               "internal_name": "WearCategory2",
               "name": "Field-Tested",
               "category": "Exterior",
               "category_name": "Exterior"
            }
         ]
      },
   "more": false,
   "more_start": false
}

And yes I'm trying to display my CS:GO inventory.

In short: what is the best way to get the market_hash_name value from the Json? and make it display a image?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire