Skip to main content

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.

Jump to: navigation, search

Difference between revisions of "User:Rick.barkhouse.oracle.com/Test1"

Line 3: Line 3:
 
=Dynamic JAXB: Flickr Example=
 
=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.
+
This example will demonstrate how to use MOXy's Dynamic JAXB features to work with public JSON and XML  feeds, without having to create <small>concrete Java classes</small>.
  
 
==Getting JSON from Reddit==
 
==Getting JSON from Reddit==

Revision as of 12:04, 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 the following JSON. For this example, we are only interested in the title and url fields of data/children.

{
  "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
        }
      },
      ...

Back to the top