Issues with parsing JSON data into a Infographic

Hi all! I am quite new to processing, and super enthousiastic. I study graphic design and this thing opens up a whole lot of new opportunities for me. However, i have a (little) problem with a project of mine. I have set up a JSON file, in order to make an infographic. I start simple, by displaying the names of some of my facebookfriends, which i have in a .json file, which looks in summary like this:

[

      {
         "name": "Huub Floor",
         "id": "503902028"
      },
      {
         "name": "Sivanski Shushan",
         "id": "516578582"
      },

]

I have done some things, and via the println function i want to simply print the names, and nothing but the names. However, the code prints the entire .json array (everything between the curly brackets) This is the code i'm using:

JSONArray names;

void setup()
{
size(800,600);
smooth();
background(255);
noStroke();

names = loadJSONArray("namen.json");

}
void draw() 
  {
for (int i=0; i < names.size(); i++) 

{

  JSONObject name = names.getJSONObject(i);

  String naam = name.getString("name");

  println(name);
   }

} 

Anyone has an idea what im doing wrong? I tried a whole bunch of stuff, but nothing seems to work. Thanks!

Answers

Sign In or Register to comment.