I am trying to get the JSON data from a Twitter search request such as this link text into my Java program so that I can parse it using Gson. How would I get the data from that URL into Java? Would I use an http request or something else? I've seen JSONRequest.get, but I can't see where that's coming from at all.
+2
A:
You need to use HttpURLConnection if you want to do it with plain java.
I'd recommend using the apache commons http client if possible
Pablo Fernandez
2010-09-06 22:44:54
A:
Most JSON parsers accept input streams, some even just URL; so either pass URL, or create input stream from one. If Gson does not allow that, maybe ask on user list what's the proper way. And maybe there is either a simple way, or support can be added.
And like PF already mentioned, it's just a regular HTTP connection that you need, nothing JSON specific is needed (except maybe for specifying content type you except, using general content-type specification method(s)).
StaxMan
2010-09-07 02:01:52