{"id":63341,"date":"2017-01-23T16:00:03","date_gmt":"2017-01-23T14:00:03","guid":{"rendered":"https:\/\/www.javacodegeeks.com\/?p=63341"},"modified":"2017-01-23T14:47:14","modified_gmt":"2017-01-23T12:47:14","slug":"go-vs-python-parsing-json-response-http-api","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2017\/01\/go-vs-python-parsing-json-response-http-api.html","title":{"rendered":"Go vs Python: Parsing a JSON response from a HTTP API"},"content":{"rendered":"<p>As part of a <a href=\"https:\/\/www.meetup.com\/graphdb-london\/events\/236256437\/\">recommendations with Neo4j talk<\/a> that I\u2019ve presented a few times over the last year I have a set of scripts that download some data from the <a href=\"https:\/\/www.meetup.com\/meetup_api\/\">meetup.com API<\/a>.<\/p>\n<p>They\u2019re all written in Python but I thought it\u2019d be a fun exercise to see what they\u2019d look like in Go. My eventual goal is to try and parallelise the API calls.<\/p>\n<p>This is the Python version of the script:<\/p>\n<pre class=\"brush:java\">import requests\r\nimport os\r\nimport json\r\n\u00a0\r\nkey =  os.environ['MEETUP_API_KEY']\r\nlat = \"51.5072\"\r\nlon = \"0.1275\"\r\n\u00a0\r\nseed_topic = \"nosql\"\r\nuri = \"https:\/\/api.meetup.com\/2\/groups?\u22a4ic={0}\u2aab={1}&amp;lon={2}&amp;key={3}\".format(seed_topic, lat, lon, key)\r\n\u00a0\r\nr = requests.get(uri)\r\nall_topics = [topic[\"urlkey\"]  for result in r.json()[\"results\"] for topic in result[\"topics\"]]\r\n\u00a0\r\nfor topic in all_topics:\r\n    print topic<\/pre>\n<p>import requests import os import json key = os.environ[&#8216;MEETUP_API_KEY&#8217;] lat = &#8220;51.5072&#8221; lon = &#8220;0.1275&#8221; seed_topic = &#8220;nosql&#8221; uri = &#8220;https:\/\/api.meetup.com\/2\/groups?&amp;topic={0}&amp;lat={1}&amp;lon={2}&amp;key={3}&#8221;.format(seed_topic, lat, lon, key) r = requests.get(uri) all_topics = [topic[&#8220;urlkey&#8221;] for result in r.json()[&#8220;results&#8221;] for topic in result[&#8220;topics&#8221;]] for topic in all_topics: print topic<\/p>\n<p>We\u2019re using the <a href=\"http:\/\/docs.python-requests.org\/en\/master\/\">requests<\/a> library to send a request to the meetup API to get the groups which have the topic \u2018nosql\u2019 in the London area. We then parse the response and print out the topics.<\/p>\n<p>Now to do the same thing in Go! The first bit of the script is almost identical:<\/p>\n<pre class=\"brush:java\">import (\r\n\t\"fmt\"\r\n\t\"os\"\r\n\t\"net\/http\"\r\n\t\"log\"\r\n\t\"time\"\r\n)\r\n\u00a0\r\nfunc handleError(err error) {\r\n\tif err != nil {\r\n\t\tfmt.Println(err)\r\n\t\tlog.Fatal(err)\r\n\t}\r\n}\r\n\u00a0\r\nfunc main() {\r\n\tvar httpClient = &amp;http.Client{Timeout: 10 * time.Second}\r\n\u00a0\r\n\tseedTopic := \"nosql\"\r\n\tlat := \"51.5072\"\r\n\tlon := \"0.1275\"\r\n\tkey := os.Getenv(\"MEETUP_API_KEY\")\r\n\u00a0\r\n\turi := fmt.Sprintf(\"https:\/\/api.meetup.com\/2\/groups?\u22a4ic=%s\u2aab=%s&amp;lon=%s&amp;key=%s\", seedTopic, lat, lon, key)\r\n\u00a0\r\n\tresponse, err := httpClient.Get(uri)\r\n\thandleError(err)\r\n\tdefer response.Body.Close()\r\n\tfmt.Println(response)\r\n}<\/pre>\n<p>import ( &#8220;fmt&#8221; &#8220;os&#8221; &#8220;net\/http&#8221; &#8220;log&#8221; &#8220;time&#8221; ) func handleError(err error) { if err != nil { fmt.Println(err) log.Fatal(err) } } func main() { var httpClient = &amp;http.Client{Timeout: 10 * time.Second} seedTopic := &#8220;nosql&#8221; lat := &#8220;51.5072&#8221; lon := &#8220;0.1275&#8221; key := os.Getenv(&#8220;MEETUP_API_KEY&#8221;) uri := fmt.Sprintf(&#8220;https:\/\/api.meetup.com\/2\/groups?&amp;topic=%s&amp;lat=%s&amp;lon=%s&amp;key=%s&#8221;, seedTopic, lat, lon, key) response, err := httpClient.Get(uri) handleError(err) defer response.Body.Close() fmt.Println(response) }<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<p>If we run that this is the output we see:<\/p>\n<pre class=\"brush:bash\">$ go cmd\/blog\/main.go\r\n\u00a0\r\n&amp;{200 OK 200 HTTP\/2.0 2 0 map[X-Meetup-Request-Id:[2d3be3c7-a393-4127-b7aa-076f150499e6] X-Ratelimit-Reset:[10] Cf-Ray:[324093a73f1135d2-LHR] X-Oauth-Scopes:[basic] Etag:[\"35a941c5ea3df9df4204d8a4a2d60150\"] Server:[cloudflare-nginx] Set-Cookie:[__cfduid=d54db475299a62af4bb963039787e2e3d1484894864; expires=Sat, 20-Jan-18 06:47:44 GMT; path=\/; domain=.meetup.com; HttpOnly] X-Meetup-Server:[api7] X-Ratelimit-Limit:[30] X-Ratelimit-Remaining:[29] X-Accepted-Oauth-Scopes:[basic] Vary:[Accept-Encoding,User-Agent,Accept-Language] Date:[Fri, 20 Jan 2017 06:47:45 GMT] Content-Type:[application\/json;charset=utf-8]] 0xc420442260 -1 [] false true map[] 0xc4200d01e0 0xc4202b2420}<\/pre>\n<p>$ go cmd\/blog\/main.go &amp;{200 OK 200 HTTP\/2.0 2 0 map[X-Meetup-Request-Id:[2d3be3c7-a393-4127-b7aa-076f150499e6] X-Ratelimit-Reset:[10] Cf-Ray:[324093a73f1135d2-LHR] X-Oauth-Scopes:[basic] Etag:[&#8220;35a941c5ea3df9df4204d8a4a2d60150&#8221;] Server:[cloudflare-nginx] Set-Cookie:[__cfduid=d54db475299a62af4bb963039787e2e3d1484894864; expires=Sat, 20-Jan-18 06:47:44 GMT; path=\/; domain=.meetup.com; HttpOnly] X-Meetup-Server:[api7] X-Ratelimit-Limit:[30] X-Ratelimit-Remaining:[29] X-Accepted-Oauth-Scopes:[basic] Vary:[Accept-Encoding,User-Agent,Accept-Language] Date:[Fri, 20 Jan 2017 06:47:45 GMT] Content-Type:[application\/json;charset=utf-8]] 0xc420442260 -1 [] false true map[] 0xc4200d01e0 0xc4202b2420}<\/p>\n<p>So far so good. Now we need to parse the response that comes back.<\/p>\n<p>Most of the examples that I came across <a href=\"http:\/\/stackoverflow.com\/questions\/17156371\/how-to-get-json-response-in-golang\">suggest creating a struct with all the fields<\/a> that you want to extract from the JSON document but that feels a bit over kill for such a simple script.<\/p>\n<p>Instead we can just create maps of (string -&gt; interface{}) and then apply type conversions where appropriate. I ended up with the following code to extract the topics:<\/p>\n<pre class=\"brush:java\">import \"encoding\/json\"\r\n\u00a0\r\nvar target map[string]interface{}\r\ndecoder := json.NewDecoder(response.Body)\r\ndecoder.Decode(\u2316)\r\n\u00a0\r\nfor _, rawGroup := range target[\"results\"].([]interface{}) {\r\n    group := rawGroup.(map[string]interface{})\r\n    for _, rawTopic := range group[\"topics\"].([]interface{}) {\r\n        topic := rawTopic.(map[string]interface{})\r\n        fmt.Println(topic[\"urlkey\"])\r\n    }\r\n}<\/pre>\n<p>import &#8220;encoding\/json&#8221; var target map[string]interface{} decoder := json.NewDecoder(response.Body) decoder.Decode(&amp;target) for _, rawGroup := range target[&#8220;results&#8221;].([]interface{}) { group := rawGroup.(map[string]interface{}) for _, rawTopic := range group[&#8220;topics&#8221;].([]interface{}) { topic := rawTopic.(map[string]interface{}) fmt.Println(topic[&#8220;urlkey&#8221;]) } }<\/p>\n<p>It\u2019s more verbose that the Python version because we have to explicitly type each thing we take out of the map at every stage, but it\u2019s not too bad. This is the full script:<\/p>\n<pre class=\"brush:java\">package main\r\n\u00a0\r\nimport (\r\n\t\"fmt\"\r\n\t\"os\"\r\n\t\"net\/http\"\r\n\t\"log\"\r\n\t\"time\"\r\n\t\"encoding\/json\"\r\n)\r\n\u00a0\r\nfunc handleError(err error) {\r\n\tif err != nil {\r\n\t\tfmt.Println(err)\r\n\t\tlog.Fatal(err)\r\n\t}\r\n}\r\n\u00a0\r\nfunc main() {\r\n\tvar httpClient = &amp;http.Client{Timeout: 10 * time.Second}\r\n\u00a0\r\n\tseedTopic := \"nosql\"\r\n\tlat := \"51.5072\"\r\n\tlon := \"0.1275\"\r\n\tkey := os.Getenv(\"MEETUP_API_KEY\")\r\n\u00a0\r\n\turi := fmt.Sprintf(\"https:\/\/api.meetup.com\/2\/groups?\u22a4ic=%s\u2aab=%s&amp;lon=%s&amp;key=%s\", seedTopic, lat, lon, key)\r\n\u00a0\r\n\tresponse, err := httpClient.Get(uri)\r\n\thandleError(err)\r\n\tdefer response.Body.Close()\r\n\u00a0\r\n\tvar target map[string]interface{}\r\n\tdecoder := json.NewDecoder(response.Body)\r\n\tdecoder.Decode(\u2316)\r\n\u00a0\r\n\tfor _, rawGroup := range target[\"results\"].([]interface{}) {\r\n\t\tgroup := rawGroup.(map[string]interface{})\r\n\t\tfor _, rawTopic := range group[\"topics\"].([]interface{}) {\r\n\t\t\ttopic := rawTopic.(map[string]interface{})\r\n\t\t\tfmt.Println(topic[\"urlkey\"])\r\n\t\t}\r\n\t}\r\n}<\/pre>\n<p>package main import ( &#8220;fmt&#8221; &#8220;os&#8221; &#8220;net\/http&#8221; &#8220;log&#8221; &#8220;time&#8221; &#8220;encoding\/json&#8221; ) func handleError(err error) { if err != nil { fmt.Println(err) log.Fatal(err) } } func main() { var httpClient = &amp;http.Client{Timeout: 10 * time.Second} seedTopic := &#8220;nosql&#8221; lat := &#8220;51.5072&#8221; lon := &#8220;0.1275&#8221; key := os.Getenv(&#8220;MEETUP_API_KEY&#8221;) uri := fmt.Sprintf(&#8220;https:\/\/api.meetup.com\/2\/groups?&amp;topic=%s&amp;lat=%s&amp;lon=%s&amp;key=%s&#8221;, seedTopic, lat, lon, key) response, err := httpClient.Get(uri) handleError(err) defer response.Body.Close() var target map[string]interface{} decoder := json.NewDecoder(response.Body) decoder.Decode(&amp;target) for _, rawGroup := range target[&#8220;results&#8221;].([]interface{}) { group := rawGroup.(map[string]interface{}) for _, rawTopic := range group[&#8220;topics&#8221;].([]interface{}) { topic := rawTopic.(map[string]interface{}) fmt.Println(topic[&#8220;urlkey&#8221;]) } } }<\/p>\n<p>Once I\u2019ve got these topics the next step is to make more API calls to get the groups for those topics.<\/p>\n<p>I want to make those API calls in parallel while making sure I don\u2019t exceed the rate limit restrictions on the API and I think I can make use of go routines, channels, and timers to do that. But that\u2019s for another post!<\/p>\n<div class=\"attribution\">\n<table>\n<tbody>\n<tr>\n<td><span class=\"reference\">Reference: <\/span><\/td>\n<td><a href=\"http:\/\/www.markhneedham.com\/blog\/2017\/01\/21\/go-vs-python-parsing-a-json-response-from-a-http-api\/\">Go vs Python: Parsing a JSON response from a HTTP API<\/a> from our <a href=\"http:\/\/www.javacodegeeks.com\/join-us\/jcg\/\">JCG partner<\/a> Mark Needham at the <a href=\"http:\/\/www.markhneedham.com\/blog\/\">Mark Needham Blog<\/a> blog.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>As part of a recommendations with Neo4j talk that I\u2019ve presented a few times over the last year I have a set of scripts that download some data from the meetup.com API. They\u2019re all written in Python but I thought it\u2019d be a fun exercise to see what they\u2019d look like in Go. My eventual &hellip;<\/p>\n","protected":false},"author":134,"featured_media":219,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15],"tags":[935,224],"class_list":["post-63341","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-software-development","tag-go","tag-python"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Go vs Python: Parsing a JSON response from a HTTP API - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"As part of a recommendations with Neo4j talk that I\u2019ve presented a few times over the last year I have a set of scripts that download some data from the\" \/>\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\/2017\/01\/go-vs-python-parsing-json-response-http-api.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Go vs Python: Parsing a JSON response from a HTTP API - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"As part of a recommendations with Neo4j talk that I\u2019ve presented a few times over the last year I have a set of scripts that download some data from the\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2017\/01\/go-vs-python-parsing-json-response-http-api.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=\"2017-01-23T14:00:03+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/python-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=\"Mark Needham\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Mark Needham\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/01\\\/go-vs-python-parsing-json-response-http-api.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/01\\\/go-vs-python-parsing-json-response-http-api.html\"},\"author\":{\"name\":\"Mark Needham\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/fdb35381baa5059768d6788cfb685313\"},\"headline\":\"Go vs Python: Parsing a JSON response from a HTTP API\",\"datePublished\":\"2017-01-23T14:00:03+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/01\\\/go-vs-python-parsing-json-response-http-api.html\"},\"wordCount\":750,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/01\\\/go-vs-python-parsing-json-response-http-api.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/python-logo.jpg\",\"keywords\":[\"Go\",\"Python\"],\"articleSection\":[\"Software Development\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/01\\\/go-vs-python-parsing-json-response-http-api.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/01\\\/go-vs-python-parsing-json-response-http-api.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/01\\\/go-vs-python-parsing-json-response-http-api.html\",\"name\":\"Go vs Python: Parsing a JSON response from a HTTP API - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/01\\\/go-vs-python-parsing-json-response-http-api.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/01\\\/go-vs-python-parsing-json-response-http-api.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/python-logo.jpg\",\"datePublished\":\"2017-01-23T14:00:03+00:00\",\"description\":\"As part of a recommendations with Neo4j talk that I\u2019ve presented a few times over the last year I have a set of scripts that download some data from the\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/01\\\/go-vs-python-parsing-json-response-http-api.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/01\\\/go-vs-python-parsing-json-response-http-api.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/01\\\/go-vs-python-parsing-json-response-http-api.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/python-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/python-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/01\\\/go-vs-python-parsing-json-response-http-api.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Software Development\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/software-development\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Go vs Python: Parsing a JSON response from a HTTP API\"}]},{\"@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\\\/fdb35381baa5059768d6788cfb685313\",\"name\":\"Mark Needham\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5489baed26ce2d932bf951ecfb47afe80bec45d3648c23521d87c83b8f1c3ea9?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5489baed26ce2d932bf951ecfb47afe80bec45d3648c23521d87c83b8f1c3ea9?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5489baed26ce2d932bf951ecfb47afe80bec45d3648c23521d87c83b8f1c3ea9?s=96&d=mm&r=g\",\"caption\":\"Mark Needham\"},\"sameAs\":[\"http:\\\/\\\/www.markhneedham.com\\\/blog\\\/\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/Mark-Needham\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Go vs Python: Parsing a JSON response from a HTTP API - Java Code Geeks","description":"As part of a recommendations with Neo4j talk that I\u2019ve presented a few times over the last year I have a set of scripts that download some data from the","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\/2017\/01\/go-vs-python-parsing-json-response-http-api.html","og_locale":"en_US","og_type":"article","og_title":"Go vs Python: Parsing a JSON response from a HTTP API - Java Code Geeks","og_description":"As part of a recommendations with Neo4j talk that I\u2019ve presented a few times over the last year I have a set of scripts that download some data from the","og_url":"https:\/\/www.javacodegeeks.com\/2017\/01\/go-vs-python-parsing-json-response-http-api.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2017-01-23T14:00:03+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/python-logo.jpg","type":"image\/jpeg"}],"author":"Mark Needham","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Mark Needham","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2017\/01\/go-vs-python-parsing-json-response-http-api.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2017\/01\/go-vs-python-parsing-json-response-http-api.html"},"author":{"name":"Mark Needham","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/fdb35381baa5059768d6788cfb685313"},"headline":"Go vs Python: Parsing a JSON response from a HTTP API","datePublished":"2017-01-23T14:00:03+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2017\/01\/go-vs-python-parsing-json-response-http-api.html"},"wordCount":750,"commentCount":0,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2017\/01\/go-vs-python-parsing-json-response-http-api.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/python-logo.jpg","keywords":["Go","Python"],"articleSection":["Software Development"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2017\/01\/go-vs-python-parsing-json-response-http-api.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2017\/01\/go-vs-python-parsing-json-response-http-api.html","url":"https:\/\/www.javacodegeeks.com\/2017\/01\/go-vs-python-parsing-json-response-http-api.html","name":"Go vs Python: Parsing a JSON response from a HTTP API - Java Code Geeks","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2017\/01\/go-vs-python-parsing-json-response-http-api.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2017\/01\/go-vs-python-parsing-json-response-http-api.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/python-logo.jpg","datePublished":"2017-01-23T14:00:03+00:00","description":"As part of a recommendations with Neo4j talk that I\u2019ve presented a few times over the last year I have a set of scripts that download some data from the","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2017\/01\/go-vs-python-parsing-json-response-http-api.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2017\/01\/go-vs-python-parsing-json-response-http-api.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2017\/01\/go-vs-python-parsing-json-response-http-api.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/python-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/python-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2017\/01\/go-vs-python-parsing-json-response-http-api.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Software Development","item":"https:\/\/www.javacodegeeks.com\/category\/software-development"},{"@type":"ListItem","position":3,"name":"Go vs Python: Parsing a JSON response from a HTTP API"}]},{"@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\/fdb35381baa5059768d6788cfb685313","name":"Mark Needham","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/5489baed26ce2d932bf951ecfb47afe80bec45d3648c23521d87c83b8f1c3ea9?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/5489baed26ce2d932bf951ecfb47afe80bec45d3648c23521d87c83b8f1c3ea9?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5489baed26ce2d932bf951ecfb47afe80bec45d3648c23521d87c83b8f1c3ea9?s=96&d=mm&r=g","caption":"Mark Needham"},"sameAs":["http:\/\/www.markhneedham.com\/blog\/"],"url":"https:\/\/www.javacodegeeks.com\/author\/Mark-Needham"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/63341","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\/134"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=63341"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/63341\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/219"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=63341"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=63341"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=63341"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}