xxxxxxxxxx
var APIURL = 'https://data.cityofnewyork.us/resource/43nn-pn8j.json';
var thestuff = {};
var isready = false;
var fontsize = 18;
function preload() {
thestuff = loadJSON(APIURL, goforit);
}
function setup() {
createCanvas(windowWidth, windowHeight);
background(255);
stroke(0);
fill(0);
textSize(fontsize);
}
function draw() {
if(isready)
{
background(0);
fill(255);
let y = fontsize;
for(let i=0; i<25; i++)
{
fill(255);
let s = '';
s+=thestuff[i].dba + ' : ';
s+=thestuff[i].cuisine_description + ', ';
s+=thestuff[i].violation_description + '!!!';
text(s, 20, y);
y+=fontsize;
fill(255, 0, 0);
let a = thestuff[i].building + ' ' + thestuff[i].street + ' ' + thestuff[i].boro + ' ' + thestuff[i].zipcode;
text(a, 40, y);
y+=fontsize;
}
}
}
function goforit() { // response function
isready = true;
}