16austin16 16austin16 - 2 years ago 112
Node.js Question

Using var in nodejs to search a json file

So im trying to search a json file but i tried this and it didn't return a value.

var info = JSON.parse(body); // Get File From Website
var itemforjson = item.market_hash_name; // Get The Item Name To Try To Use It In Json
depitems[i].value = parseInt(info.itemforjson); // Has To Be A Number

Answer Source

Use parseInt(info[itemforjson]) on the last line.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download