How to access JSON data in classic ASP -


i'm working on classic asp-project , use asp xtreme evolution parse json data (found here: how access json data in classic asp using json2.asp or aspjson libraries?) tried, can't. how access json data?

{      "result":[         {            "key":"2607037",          "sts":"finished",          "stsdetail":"finished",          "sname":"ice hockey",          "home":{               "1p":"0",             "fe":"2",             "3p":"1",             "2p":"1",             "ord":"2",             "rs":"2"          },          "away":{               "ord":"0",             "1p":"0",             "rs":"0",             "2p":"0",             "3p":"0",             "fe":"0"          }       },       {            "key":"2435948",          "sts":"finished",          "stsdetail":"finished",          "sname":"soccer",          "home":{               "ord":"2",             "rs":"2",             "fe":"2",             "ht":"1"          },          "away":{               "ord":"0",             "rs":"0",             "fe":"0",             "ht":"0"          }       },       {            "key":"2606031",          "sts":"cancelled",          "stsdetail":"cancelled",          "sname":"tennis"       }    ] } 

code:

set restaurant = ojson.data("result")  each itm in restaurant      if not isobject(restaurant.item(itm))         response.write itm  &" : "& restaurant.item(itm) & "<br/>"     else     'opening         each dayy in restaurant.item(itm)            response.write dayy & ":"                 response.write restaurant.item(itm)(dayy)                  if restaurant.item(itm)(dayy)  <> ""                     response.write " - "                     response.write restaurant.item(itm)(dayy)                  end if              response.write "<br/>"         next     end if 

you're missing indexes in array, try this:

for each dayy in restaurant.item(itm)         response.write dayy & ":"             response.write restaurant.item(itm)(dayy)(0)               if restaurant.item(itm)(dayy)(1) <> ""                 response.write " - "                 response.write restaurant.item(itm)(dayy)(1)              end if          response.write "<br/>"     next 

Comments

Popular posts from this blog

PHP and MySQL WP -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

go - golang pprof for c library code -