{"id":14148,"date":"2013-06-14T16:00:39","date_gmt":"2013-06-14T13:00:39","guid":{"rendered":"http:\/\/www.javacodegeeks.com\/?p=14148"},"modified":"2013-06-14T08:52:18","modified_gmt":"2013-06-14T05:52:18","slug":"parsing-espn-api-using-java-and-google-gson","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2013\/06\/parsing-espn-api-using-java-and-google-gson.html","title":{"rendered":"Parsing ESPN API using Java and Google GSON"},"content":{"rendered":"<p>For my first post, I&#8217;ll explain how to parse the ESPN API. \u00a0The API documentation can be found at <a href=\"http:\/\/developer.espn.com\/docs\">http:\/\/developer.espn.com\/docs<\/a>.<\/p>\n<p>Firstly, you&#8217;ll need to request an API key, then you can start querying the REST API to retrieve the JSON response. \u00a0In the following example, I&#8217;m going to query simply for all the players in the sport of &#8220;Soccer&#8221; (dam that\u00a0Americanism\u00a0) \u00a0that play in the Premier League in England.<\/p>\n<p>From reading the documentation, this is the URL that I need to send requests to (with [apiKey] replaced with the correct value).<br \/>\n&nbsp;<\/p>\n<blockquote>\n<p>http:\/\/api.espn.com\/v1\/sports\/soccer\/eng.1\/athletes?apikey=[apiKey]<\/p>\n<\/blockquote>\n<p>Something to bear in mind first of all, there&#8217;s an offset value that forces you to make multiple queries if you want more than just the 50 results, this is set with a parameter known as offset. \u00a0So for instance, to get the results from 51-101 the following query would pull these back. \u00a0We&#8217;ll come back to this later as this can cause some slight issues.<\/p>\n<blockquote>\n<p>http:\/\/api.espn.com\/v1\/sports\/soccer\/eng.1\/athletes?apikey=[apiKey]&amp;offset=51<\/p>\n<\/blockquote>\n<p>Now I&#8217;ve got the description out the way, I&#8217;ll start the code, it should be noted I&#8217;m using GSON to parse the JSON so you&#8217;ll need to add the following Maven dependency.<\/p>\n<pre class=\"brush:java\">&lt;dependency&gt;\r\n\t&lt;groupId&gt;com.google.code.gson&lt;\/groupId&gt;\r\n\t&lt;artifactId&gt;gson&lt;\/artifactId&gt;\r\n\t&lt;version&gt;2.2.2&lt;\/version&gt;\r\n&lt;\/dependency&gt;<\/pre>\n<p>Once this has been done and you&#8217;ve ran the maven:install to get the jars downloaded, you can start querying. The code below is simply required to download the JSON from the ESPN API<\/p>\n<pre class=\"brush:java\">  private static String readUrl(final String urlString) throws Exception {\r\n\t\tBufferedReader reader = null;\r\n\t\ttry {\r\n\t\t\tfinal URL url = new URL(urlString);\r\n\t\t\treader = new BufferedReader(new InputStreamReader(url.openStream()));\r\n\t\t\tfinal StringBuffer buffer = new StringBuffer();\r\n\t\t\tint read;\r\n\t\t\tfinal char[] chars = new char[1024];\r\n\t\t\twhile ((read = reader.read(chars)) != -1) {\r\n\t\t\t\tbuffer.append(chars, 0, read);\r\n\t\t\t}\r\n\t\t\treturn buffer.toString();\r\n\t\t} finally {\r\n\t\t\tif (reader != null) {\r\n\t\t\t\treader.close();\r\n\t\t\t}\r\n\t\t}\r\n\t}<\/pre>\n<p>Now we can start parsing this JSON, because the JSON produced has a lot of redundant data, I decided against parsing it into objects and just queried it raw. <div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<pre class=\"brush:java\">private static JsonArray getAthletesJsonArray(final int offset)\r\n  \t\tthrows Exception {\r\n\t\tfinal String json = readUrl(getUrl(offset));\r\n\t\tfinal JsonArray sports = getSportsJsonArray(json);\r\n\t\tfinal JsonElement league = sports.get(0);\r\n\t\treturn league.getAsJsonObject().get(\"leagues\").getAsJsonArray().get(0)\r\n\t\t\t\t.getAsJsonObject().get(\"athletes\").getAsJsonArray();\r\n\t}\r\n\r\n\tprivate static JsonArray getSportsJsonArray(final String json) {\r\n\t\tfinal JsonArray sports = new JsonParser().parse(json).getAsJsonObject()\r\n\t\t\t\t.get(\"sports\").getAsJsonArray();\r\n\t\treturn sports;\r\n\t}\r\n\r\n\tprivate static String getUrl(final int offset) {\r\n\t\treturn APIURL + APIKEY + \"&offset=\" + offset;\r\n\t}<\/pre>\n<p>This will give us a JsonArray of Athletes and the associated data that can be pulled about them. It should be noted as this point, the response here varies based on your API allowance (free, partner, paid etc). I&#8217;ll leave the relevant ESPN API page here http:\/\/developer.espn.com\/docs\/athletes#parameters.<\/p>\n<p>Now, as we&#8217;ve got the relevant JsonArray we want, we can just loop through it to return the data about each player. <\/p>\n<pre class=\"brush:java\">for (int offset = 1; offset &lt; 650; offset = offset + 50) {\r\n  \t\ttry {\r\n\t\t\t\tfinal JsonArray athletes = getAthletesJsonArray(offset);\r\n\t\t\t\tfor (final JsonElement athlete : athletes) {\r\n\t\t\t\t\tSystem.out.println(athlete.getAsJsonObject()\r\n\t\t\t\t\t\t\t.get(\"fullName\"));\r\n\t\t\t\t}\r\n\t\t\t\tThread.sleep(100);\r\n\t\t\t} catch (Exception e) {\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t}\r\n\t\t}<\/pre>\n<p>It should be noted a couple of things that may look odd about this code. Firstly, the reason for the sleep is because the API has a limit of how many times a second you can call it, currently as I write this for free you&#8217;re limited to once every 3 seconds. Secondly, the reason it&#8217;s in a loop of 650 is to do with the offset I referenced earlier in this post. This means you need to query each 50 players, this seems a little computationally expensive as I&#8217;d have thought it&#8217;d be easier just to return the 602 players rather than having to do the heavy loading of receiving 12 RESTful calls.<\/p>\n<p>Then, when we put this all together you get the class below, this will loop through every player giving you their first name.<\/p>\n<pre class=\"brush:java\">package org.espn.app;\r\n\r\nimport java.io.BufferedReader;\r\nimport java.io.InputStreamReader;\r\nimport java.net.URL;\r\n\r\nimport com.google.gson.JsonArray;\r\nimport com.google.gson.JsonElement;\r\nimport com.google.gson.JsonParser;\r\n\r\n\/**\r\n * @author David Gray \r\n * \r\n * This class is simply an example of how to parse the Json\r\n *         API for ESPN.\r\n *\/\r\npublic class EspnParser {\r\n\r\n  private static final String APIKEY = \"apiKey\";\r\n\tprivate static final String APIURL = \"http:\/\/api.espn.com\/v1\/sports\/soccer\/eng.1\/athletes?apikey=\";\r\n\r\n\t\/**\r\n\t * @param arguments\r\n\t *            for main method.\r\n\t *\/\r\n\tpublic static void main(final String[] args) {\r\n\t\tfor (int offset = 1; offset &lt; 650; offset = offset + 50) {\r\n\t\t\ttry {\r\n\t\t\t\tfinal JsonArray athletes = getAthletesJsonArray(offset);\r\n\t\t\t\tfor (final JsonElement athlete : athletes) {\r\n\t\t\t\t\tSystem.out.println(athlete.getAsJsonObject()\r\n\t\t\t\t\t\t\t.get(\"fullName\"));\r\n\t\t\t\t}\r\n\t\t\t\tThread.sleep(100);\r\n\t\t\t} catch (Exception e) {\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tprivate static JsonArray getAthletesJsonArray(final int offset)\r\n\t\t\tthrows Exception {\r\n\t\tfinal String json = readUrl(getUrl(offset));\r\n\t\tfinal JsonArray sports = getSportsJsonArray(json);\r\n\t\tfinal JsonElement league = sports.get(0);\r\n\t\treturn league.getAsJsonObject().get(\"leagues\").getAsJsonArray().get(0)\r\n\t\t\t\t.getAsJsonObject().get(\"athletes\").getAsJsonArray();\r\n\t}\r\n\r\n\tprivate static JsonArray getSportsJsonArray(final String json) {\r\n\t\tfinal JsonArray sports = new JsonParser().parse(json).getAsJsonObject()\r\n\t\t\t\t.get(\"sports\").getAsJsonArray();\r\n\t\treturn sports;\r\n\t}\r\n\r\n\tprivate static String getUrl(final int offset) {\r\n\t\treturn APIURL + APIKEY + \"&offset=\" + offset;\r\n\t}\r\n\r\n\tprivate static String readUrl(final String urlString) throws Exception {\r\n\t\tBufferedReader reader = null;\r\n\t\ttry {\r\n\t\t\tfinal URL url = new URL(urlString);\r\n\t\t\treader = new BufferedReader(new InputStreamReader(url.openStream()));\r\n\t\t\tfinal StringBuffer buffer = new StringBuffer();\r\n\t\t\tint read;\r\n\t\t\tfinal char[] chars = new char[1024];\r\n\t\t\twhile ((read = reader.read(chars)) != -1) {\r\n\t\t\t\tbuffer.append(chars, 0, read);\r\n\t\t\t}\r\n\t\t\treturn buffer.toString();\r\n\t\t} finally {\r\n\t\t\tif (reader != null) {\r\n\t\t\t\treader.close();\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n}\r\n<\/pre>\n<p>You can download the full project on github <a href=\"https:\/\/github.com\/david99world\/EspnApiParsingExample\">https:\/\/github.com\/david99world\/EspnApiParsingExample<\/a><br \/>\n&nbsp;<\/p>\n<div style=\"border: 1px solid #D8D8D8; background: #FAFAFA; width: 100%; padding-left: 5px;\"><b><i>Reference: <\/i><\/b><a href=\"http:\/\/codemumble.blogspot.com\/2013\/04\/parsing-espn-api-using-java-and-google.html\">Parsing ESPN API using Java and Google GSON<\/a> from our <a href=\"http:\/\/www.javacodegeeks.com\/jcg\">JCG partner<\/a> David Gray at the <a href=\"http:\/\/codemumble.blogspot.com\/\">Code Mumble<\/a> blog.<\/div>\n","protected":false},"excerpt":{"rendered":"<p>For my first post, I&#8217;ll explain how to parse the ESPN API. \u00a0The API documentation can be found at http:\/\/developer.espn.com\/docs. Firstly, you&#8217;ll need to request an API key, then you can start querying the REST API to retrieve the JSON response. \u00a0In the following example, I&#8217;m going to query simply for all the players in &hellip;<\/p>\n","protected":false},"author":450,"featured_media":175,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[128,69],"class_list":["post-14148","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-enterprise-java","tag-gson","tag-json"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Parsing ESPN API using Java and Google GSON<\/title>\n<meta name=\"description\" content=\"For my first post, I&#039;ll explain how to parse the ESPN API. \u00a0The API documentation can be found at http:\/\/developer.espn.com\/docs. Firstly, you&#039;ll need to\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javacodegeeks.com\/2013\/06\/parsing-espn-api-using-java-and-google-gson.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Parsing ESPN API using Java and Google GSON\" \/>\n<meta property=\"og:description\" content=\"For my first post, I&#039;ll explain how to parse the ESPN API. \u00a0The API documentation can be found at http:\/\/developer.espn.com\/docs. Firstly, you&#039;ll need to\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2013\/06\/parsing-espn-api-using-java-and-google-gson.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2013-06-14T13:00:39+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/json-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"David Gray\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/_DavidGray\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"David Gray\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/06\\\/parsing-espn-api-using-java-and-google-gson.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/06\\\/parsing-espn-api-using-java-and-google-gson.html\"},\"author\":{\"name\":\"David Gray\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/e737b17be63bc5f2e7c14b8ffe59e397\"},\"headline\":\"Parsing ESPN API using Java and Google GSON\",\"datePublished\":\"2013-06-14T13:00:39+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/06\\\/parsing-espn-api-using-java-and-google-gson.html\"},\"wordCount\":547,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/06\\\/parsing-espn-api-using-java-and-google-gson.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/json-logo.jpg\",\"keywords\":[\"Gson\",\"JSON\"],\"articleSection\":[\"Enterprise Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/06\\\/parsing-espn-api-using-java-and-google-gson.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/06\\\/parsing-espn-api-using-java-and-google-gson.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/06\\\/parsing-espn-api-using-java-and-google-gson.html\",\"name\":\"Parsing ESPN API using Java and Google GSON\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/06\\\/parsing-espn-api-using-java-and-google-gson.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/06\\\/parsing-espn-api-using-java-and-google-gson.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/json-logo.jpg\",\"datePublished\":\"2013-06-14T13:00:39+00:00\",\"description\":\"For my first post, I'll explain how to parse the ESPN API. \u00a0The API documentation can be found at http:\\\/\\\/developer.espn.com\\\/docs. Firstly, you'll need to\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/06\\\/parsing-espn-api-using-java-and-google-gson.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/06\\\/parsing-espn-api-using-java-and-google-gson.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/06\\\/parsing-espn-api-using-java-and-google-gson.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/json-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/json-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/06\\\/parsing-espn-api-using-java-and-google-gson.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Enterprise Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\\\/enterprise-java\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Parsing ESPN API using Java and Google GSON\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/e737b17be63bc5f2e7c14b8ffe59e397\",\"name\":\"David Gray\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/857980653a3d30028da867a449344cad0ab5672bdba79c65a09ffe376f18b26d?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/857980653a3d30028da867a449344cad0ab5672bdba79c65a09ffe376f18b26d?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/857980653a3d30028da867a449344cad0ab5672bdba79c65a09ffe376f18b26d?s=96&d=mm&r=g\",\"caption\":\"David Gray\"},\"description\":\"David is a software engineer with a passion for everything Java and the web. He is a server side java developer based in Derby, England by day and a Android, jQuery, jack of all trades by night.\",\"sameAs\":[\"http:\\\/\\\/codemumble.blogspot.com\\\/\",\"http:\\\/\\\/www.linkedin.com\\\/in\\\/davidgrayjava\",\"https:\\\/\\\/x.com\\\/https:\\\/\\\/twitter.com\\\/_DavidGray\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/david-gray\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Parsing ESPN API using Java and Google GSON","description":"For my first post, I'll explain how to parse the ESPN API. \u00a0The API documentation can be found at http:\/\/developer.espn.com\/docs. Firstly, you'll need to","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.javacodegeeks.com\/2013\/06\/parsing-espn-api-using-java-and-google-gson.html","og_locale":"en_US","og_type":"article","og_title":"Parsing ESPN API using Java and Google GSON","og_description":"For my first post, I'll explain how to parse the ESPN API. \u00a0The API documentation can be found at http:\/\/developer.espn.com\/docs. Firstly, you'll need to","og_url":"https:\/\/www.javacodegeeks.com\/2013\/06\/parsing-espn-api-using-java-and-google-gson.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2013-06-14T13:00:39+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/json-logo.jpg","type":"image\/jpeg"}],"author":"David Gray","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/_DavidGray","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"David Gray","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2013\/06\/parsing-espn-api-using-java-and-google-gson.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2013\/06\/parsing-espn-api-using-java-and-google-gson.html"},"author":{"name":"David Gray","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/e737b17be63bc5f2e7c14b8ffe59e397"},"headline":"Parsing ESPN API using Java and Google GSON","datePublished":"2013-06-14T13:00:39+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2013\/06\/parsing-espn-api-using-java-and-google-gson.html"},"wordCount":547,"commentCount":1,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2013\/06\/parsing-espn-api-using-java-and-google-gson.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/json-logo.jpg","keywords":["Gson","JSON"],"articleSection":["Enterprise Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2013\/06\/parsing-espn-api-using-java-and-google-gson.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2013\/06\/parsing-espn-api-using-java-and-google-gson.html","url":"https:\/\/www.javacodegeeks.com\/2013\/06\/parsing-espn-api-using-java-and-google-gson.html","name":"Parsing ESPN API using Java and Google GSON","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2013\/06\/parsing-espn-api-using-java-and-google-gson.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2013\/06\/parsing-espn-api-using-java-and-google-gson.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/json-logo.jpg","datePublished":"2013-06-14T13:00:39+00:00","description":"For my first post, I'll explain how to parse the ESPN API. \u00a0The API documentation can be found at http:\/\/developer.espn.com\/docs. Firstly, you'll need to","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2013\/06\/parsing-espn-api-using-java-and-google-gson.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2013\/06\/parsing-espn-api-using-java-and-google-gson.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2013\/06\/parsing-espn-api-using-java-and-google-gson.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/json-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/json-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2013\/06\/parsing-espn-api-using-java-and-google-gson.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java","item":"https:\/\/www.javacodegeeks.com\/category\/java"},{"@type":"ListItem","position":3,"name":"Enterprise Java","item":"https:\/\/www.javacodegeeks.com\/category\/java\/enterprise-java"},{"@type":"ListItem","position":4,"name":"Parsing ESPN API using Java and Google GSON"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/e737b17be63bc5f2e7c14b8ffe59e397","name":"David Gray","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/857980653a3d30028da867a449344cad0ab5672bdba79c65a09ffe376f18b26d?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/857980653a3d30028da867a449344cad0ab5672bdba79c65a09ffe376f18b26d?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/857980653a3d30028da867a449344cad0ab5672bdba79c65a09ffe376f18b26d?s=96&d=mm&r=g","caption":"David Gray"},"description":"David is a software engineer with a passion for everything Java and the web. He is a server side java developer based in Derby, England by day and a Android, jQuery, jack of all trades by night.","sameAs":["http:\/\/codemumble.blogspot.com\/","http:\/\/www.linkedin.com\/in\/davidgrayjava","https:\/\/x.com\/https:\/\/twitter.com\/_DavidGray"],"url":"https:\/\/www.javacodegeeks.com\/author\/david-gray"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/14148","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/450"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=14148"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/14148\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/175"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=14148"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=14148"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=14148"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}