REST calls and JSON results in Java
I recently had the need interact with Twittervision’s RESTful api from Java. As usual, I started googling around for a solution but nothing obviously stood out. There are a handful of RESTful java frameworks, but these focus on providing a RESTful api and not consuming one. Finally, after an annoyingly difficult search I found an impressively simple solution based on Jersey.
The point to realize is that Jersey provides both a sever and a client api. To make use of the client api requires three simple lines:
The result is a string of JSON, but now, how to parse it. After searching around I ended up settling on json-simple. A few simple lines of code and we can get the address for any twitter user.
So, once again, simple stuff but not as obvious as I was hoping it would be.






