Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "EclipseLink/Examples/MOXy/JSON Twitter"
< EclipseLink | Examples | MOXy
Line 40: | Line 40: | ||
"profile_image_url":"http://a2.twimg.com/profile_images/1301749249/44aki110_normal.jpg", | "profile_image_url":"http://a2.twimg.com/profile_images/1301749249/44aki110_normal.jpg", | ||
"source":"<a href="http://www.soicha.com" rel="nofollow">SOICHA</a>", | "source":"<a href="http://www.soicha.com" rel="nofollow">SOICHA</a>", | ||
− | "text":"How do | + | "text":"How do u pronounce JAXB?: Like u kno, URL is earl...", |
− | + | "to_user_id":null, | |
"to_user_id_str":null | "to_user_id_str":null | ||
}, | }, | ||
Line 58: | Line 58: | ||
"profile_image_url":"http://a2.twimg.com/sticky/default_profile_images/default_profile_3_normal.png", | "profile_image_url":"http://a2.twimg.com/sticky/default_profile_images/default_profile_3_normal.png", | ||
"source":"<a href="http://twitterfeed.com" rel="nofollow">twitterfeed</a>", | "source":"<a href="http://twitterfeed.com" rel="nofollow">twitterfeed</a>", | ||
− | "text":"How | + | "text":"How do u customise the XML output of Jersey JAXB serialisation: http://bit.ly/ogK4Xg", |
"to_user_id":null, | "to_user_id":null, | ||
"to_user_id_str":null | "to_user_id_str":null |
Revision as of 16:34, 15 June 2012
JSON Binding and Twitter
In this example our JSON corresponds to the results of a query to get recent tweets about JAXB. We will use the Twitter Search API for this.
Twitter Query
Below is the URL corresponding to the search. We are looking for posts containing the word "jaxb", and want the result returned as JSON:
http://search.twitter.com/search.json?q=jaxb
JSON Result
Below is an example of the JSON returned from Twitter:
{ "completed_in":0.153, "max_id":101941099769245696, "max_id_str":"101941099769245696", "next_page":"?page=2&max_id=101941099769245696&q=jaxb", "page":1, "query":"jaxb", "refresh_url":"?since_id=101941099769245696&q=jaxb", "results":[ { "created_at":"Fri, 12 Aug 2011 09:00:26 +0000", "from_user":"44aki110", "from_user_id":92669210, "from_user_id_str":"92669210", "geo":null, "id":101941099769245696, "id_str":"101941099769245696", "iso_language_code":"ja", "metadata":{ "result_type":"recent" }, "profile_image_url":"http://a2.twimg.com/profile_images/1301749249/44aki110_normal.jpg", "source":"<a href="http://www.soicha.com" rel="nofollow">SOICHA</a>", "text":"How do u pronounce JAXB?: Like u kno, URL is earl...", "to_user_id":null, "to_user_id_str":null }, { "created_at":"Fri, 12 Aug 2011 01:14:57 +0000", "from_user":"stackfeed", "from_user_id":212341639, "from_user_id_str":"212341639", "geo":null, "id":101823955765170176, "id_str":"101823955765170176", "iso_language_code":"en", "metadata":{ "result_type":"recent" }, "profile_image_url":"http://a2.twimg.com/sticky/default_profile_images/default_profile_3_normal.png", "source":"<a href="http://twitterfeed.com" rel="nofollow">twitterfeed</a>", "text":"How do u customise the XML output of Jersey JAXB serialisation: http://bit.ly/ogK4Xg", "to_user_id":null, "to_user_id_str":null },