I'm using Processing to parse data I downloaded from Twitter's Streaming API, and I have a question about how to translate something from Javascript into Processing.
Basically, the information I got from Twitter roughly looks like this:
[
{"created-at": "May 5th, xx:xx",
"text": "This is the content of the tweet",
"user":{
"name": "John Doe",
"friends_count": 100,
}
}
]
With my current code:
JSONObject tweets = values.getJSONObject(i); String time = tweets.getString("created-at"); String tweet_text = tweets.getString("text");
I can use the tweets.getString("x");
to access anything within the first layer of brackets (pardon my non-technical term, I'm new to this), but how do I get into the "user" array?
According to this answer, the javascript solution would look something like this:
var author_name = tweets.user[0].name;
But I'm not sure how to translate that to code that Processing knows how to interpret. I tried this:
String author_name = tweets.user[0].getString("name");
But that's not working. Does anybody have suggestions?