Keep data in the script (or paste sales.json). Parse and log.
Goal
Parse a kiosk JSON string and log units.
const text = '{"city":"Nairobi","units":12,"shillings":480}';
const row = JSON.parse(text);
console.log(row.city, row.units);const text = `[\n {"city":"Nairobi","units":12},\n {"city":"Mombasa","units":8}\n]`;
const rows = JSON.parse(text);
console.log(rows.map((r) => r.city));const lines = "Nairobi,12\nMombasa,8";
for (const line of lines.split("\n")) {
const [city, units] = line.split(",");
console.log(city, Number(units));
}console.log("sales.json is a banner download — or paste the string as above");