JSON Text Parse newbie question

Hello, I have been trying to get acquainted with prof Schiffman's JSON parsing tutorial. I am trying to add names to bubbles. It should be easy, but I'm missing something here. Any help would be greatly appreciated.

var x = 0;
var spaceData;

function setup() {
  createCanvas(400, 400);

  loadJSON("http://" + "api.open-notify.org/astros.json", gotData, "jsonp");
  //json object
}

function gotData(data) {
  spaceData = data

}

function draw() {

  background(0);
  if (spaceData) {
  randomSeed(4);
    for (var i = 0; i < spaceData.number; i++) {
      var rx = random(height);
      var ry = random(width);
      fill(255);
      ellipse(rx, ry, 16, 16);

      textSize(15);
      text(spaceData.people, rx, ry);
    }
  }
}

Answers

Sign In or Register to comment.