Hallo zusammen, bin hier irwie am verzweifeln, vorweg ich bin noch nicht so lange dabei mich mit js auseinander zu setzen.
Ich frage eine Api ab und möchte dies in einer json Datei speichern. klappt auch soweit ganz gut, doch ist das was gespeichert wird zu viel für mich, also nicht relevantes Zeug.
(Das ganze ist in einem nodejs script)
API call:
Snippet (Original ca.300000 Zeilen) aus der erstellten "prices.json" Datei:
Meine Frage nun, ist es irgendiwe möglich, das nur noch dies:
in der "prices.json" gespeichert wird?
Also quasi alle
"market_hash_name": price
in diesem Format.
mfG
André
Ich frage eine Api ab und möchte dies in einer json Datei speichern. klappt auch soweit ganz gut, doch ist das was gespeichert wird zu viel für mich, also nicht relevantes Zeug.
(Das ganze ist in einem nodejs script)
API call:
Code:
function getPriceList() { request(priceUrl, (error, response, body) => { if (error || response.statusCode !== 200) return console.log(`Error: ${error} - Status Code: ${response.statusCode}`); //console.log("DEBUG: " + body); fs.writeFileSync("prices.json", JSON.stringify(JSON.parse(body), null, 2)); }); } getPriceList();
Code:
{ "status": "success", "prices": [ { "app_id": "730", "context_id": "2", "market_hash_name": "Blueberries Buckshot | NSWC SEAL", "price": "1.71", "pricing_mode": "market", "skewness": "-0.49", "created_at": 1631410301, "icon_url": null, "name_color": null, "quality_color": null, "rarity_color": null, "instant_sale_price": null }, { "app_id": "730", "context_id": "2", "market_hash_name": "The Doctor Romanov | Sabre", "price": "3.06", "pricing_mode": "market", "skewness": "-0.05", "created_at": 1631419491, "icon_url": null, "name_color": null, "quality_color": null, "rarity_color": null, "instant_sale_price": "1.22" }, { "app_id": "730", "context_id": "2", "market_hash_name": "Two Times McCoy | TACP Cavalry", "price": "1.23", "pricing_mode": "market", "skewness": "-0.11", "created_at": 1631407484, "icon_url": null, "name_color": null, "quality_color": null, "rarity_color": null, "instant_sale_price": null } ] }
Code:
{ "Blueberries Buckshot | NSWC SEAL": 1.71, "The Doctor Romanov | Sabre": 3.06, "Two Times McCoy | TACP Cavalry": 1.23 }
Also quasi alle
"market_hash_name": price
in diesem Format.
mfG
André
Comment