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 "User:Rick.barkhouse.oracle.com/Test1"
Line 9: | Line 9: | ||
Reddit provides a public JSON feed using the following URL format: | Reddit provides a public JSON feed using the following URL format: | ||
− | < | + | <code> |
http://www.reddit.com/r/science/top/.json?sort=top&t=day&limit=5 | http://www.reddit.com/r/science/top/.json?sort=top&t=day&limit=5 | ||
− | </ | + | </code> |
This will return us JSON that looks like this: | This will return us JSON that looks like this: | ||
− | <source lang=" | + | <div style="width:850px"> |
+ | <source lang="text"> | ||
{ | { | ||
"kind":"Listing", | "kind":"Listing", | ||
Line 65: | Line 66: | ||
... | ... | ||
</source> | </source> | ||
+ | </div> |
Revision as of 11:59, 28 May 2013
Dynamic JAXB: Flickr Example
This example will demonstrate how to use MOXy's Dynamic JAXB features to work with public JSON and XML feeds, without having to create concrete Java classes.
Getting JSON from Reddit
Reddit provides a public JSON feed using the following URL format:
http://www.reddit.com/r/science/top/.json?sort=top&t=day&limit=5
This will return us JSON that looks like this:
{ "kind":"Listing", "data":{ "modhash":"qdohhwkxss9091dc13eed91db333b619420a787aa2a39b3982", "children":[ { "kind":"t3", "data":{ "domain":"news.mongabay.com", "banned_by":null, "media_embed":{ }, "subreddit":"science", "selftext_html":null, "selftext":"", "likes":null, "link_flair_text":null, "id":"1f5jv3", "clicked":false, "title":"Plants re-grow after 500 years under the ice", "media":null, "score":2665, "approved_by":null, "over_18":false, "hidden":false, "thumbnail":"", "subreddit_id":"t5_mouw", "edited":false, "link_flair_css_class":null, "author_flair_css_class":null, "downs":5569, "saved":false, "is_self":false, "permalink":"/r/science/comments/1f5jv3/plants_regrow_after_500_years_under_the_ice/", "name":"t3_1f5jv3", "created":1369712639.0, "url":"http://news.mongabay.com/2013/0527-dimitrova-ice-plants.html", "author_flair_text":null, "author":"soyuz-capsule", "created_utc":1369683839.0, "ups":8234, "num_comments":178, "num_reports":null, "distinguished":null } }, ...