Keep the JSON in the script (or paste sales.json).
Goal
Parse two rows and log cities.
interface Sale { city: string; units: number }
const text = `[\n {"city":"Nairobi","units":12},\n {"city":"Mombasa","units":8}\n]`;
const rows = JSON.parse(text) as Sale[];
console.log(rows.map((r) => r.city));interface Sale { city: string; units: number; shillings: number }
const row: Sale = { city: "Kisumu", units: 5, shillings: 200 };
console.log(row.shillings);const lines = "Nairobi,12\nNakuru,4";
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");