# Accessing the JSON part of this HTTP response

**URL:** <https://discourse.julialang.org/t/accessing-the-json-part-of-this-http-response/40805>\
**Category:** New to Julia\
**Tags:** json, https\
**Created:** [June 5, 2020, 11:21am UTC](https://discourse.julialang.org/t/accessing-the-json-part-of-this-http-response/40805 "2020-06-05T11:21:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nash](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nash/32/14482_2.png) [@Nash](https://discourse.julialang.org/u/Nash)\
**Post date:** [June 5, 2020, 11:21am UTC](https://discourse.julialang.org/t/accessing-the-json-part-of-this-http-response/40805/1 "2020-06-05T11:21:34Z")

</div>

I have used the code provided here ([link to Stackoverflow](https://stackoverflow.com/questions/54612993/how-to-access-an-api-via-julia-http)) to access the Betfair API. And things work; a response is obtained. However, I would now like to use the data that I have retrieved, and that is what I cannot figure out how to do.

I get the following HTTP response, which clearly contains a JSON part. The data is contained in “ListEventTypesResponse” (see the link for the code):

HTTP.Messages.Response:

“”"  
HTTP/1.1 200 OK  
Date: Fri, 05 Jun 2020 11:16:47 GMT  
Cache-Control: no-cache  
Content-Type: application/json  
Vary: Accept-Encoding, User-Agent  
Content-Length: 1722  
Content-Security-Policy-Report-Only: default-src ‘unsafe-inline’ ‘unsafe-eval’ data: https: wss:; report-uri [https://shk.betfair.com/csp](https://shk.betfair.com/csp)  
X-XSS-Protection: 1; mode=block

{“jsonrpc”:“2.0”,“result”:[{“eventType”:{“id”:“1”,“name”:“Soccer”},“marketCount”:4112},{“eventType”:{“id”:“2”,“name”:“Tennis”},“marketCount”:130},{“eventType”:{“id”:“3”,“name”:“Golf”},“marketCount”:8},{“eventType”:{“id”:“4”,“name”:“Cricket”},“marketCount”:12},{“eventType”:{“id”:“5”,“name”:“Rugby Union”},“marketCount”:22},{“eventType”:{“id”:“1477”,“name”:“Rugby League”},“marketCount”:69},{“eventType”:{“id”:“6”,“name”:“Boxing”},“marketCount”:18},{“eventType”:{“id”:“7”,“name”:“Horse Racing”},“marketCount”:654},{“eventType”:{“id”:“8”,“name”:“Motor Sport”},“marketCount”:3},{“eventType”:{“id”:“27454571”,“name”:“Esports”},“marketCount”:110},{“eventType”:{“id”:“28361978”,“name”:“Lottery Specials”},“marketCount”:1},{“eventType”:{“id”:“10”,“name”:“Special Bets”},“marketCount”:10},{“eventType”:{“id”:“998917”,“name”:“Volleyball”},“marketCount”:2},{“eventType”:{“id”:“11”,“name”:“Cycling”},“marketCount”:6},{“eventType”:{“id”:“2152880”,“name”:“Gaelic Games”},“marketCount”:2},{“eventType”:{“id”:“3988”  
⋮  
1722-byte body  
“”"

How can I access the JSON part of the response?

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [June 5, 2020, 11:35am UTC](https://discourse.julialang.org/t/accessing-the-json-part-of-this-http-response/40805/2 "2020-06-05T11:35:13Z")

</div>

Isn’t that already explained in the Stackoverflow link?

```julia
using JSON
response_text = String(response.body)
JSON.parse(response_text)

```

---

<div class="post-metadata">

**Author:** ![Nash](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nash/32/14482_2.png) [@Nash](https://discourse.julialang.org/u/Nash)\
**Post date:** [June 5, 2020, 11:44am UTC](https://discourse.julialang.org/t/accessing-the-json-part-of-this-http-response/40805/3 "2020-06-05T11:44:08Z")

</div>

> [@kristoffer.carlsson](#):
>
> ```julia
> response_text = String(response.body)
> JSON.parse(response_text)
> 
> ```

I completely missed that. My apologies.
