# Unable to parse JSON files

**URL:** <https://community.opentargets.org/t/unable-to-parse-json-files/77>\
**Category:** Data downloads\
**Created:** [30 April 2021 16:23 UTC](https://community.opentargets.org/t/unable-to-parse-json-files/77 "2021-04-30T16:23:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sigven](https://dub1.discourse-cdn.com/flex017/user_avatar/community.opentargets.org/sigven/32/36_2.png) [@sigven](https://community.opentargets.org/u/sigven)\
**Post date:** [30 April 2021 16:23 UTC](https://community.opentargets.org/t/unable-to-parse-json-files/77/1 "2021-04-30T16:23:58Z")

</div>

Hi,

I am unable to parse the JSON files available for download (using the [jsonlite package](https://github.com/jeroen/jsonlite) in R). I have tried both drugs, targets etc, but all return the same error:

Error in parse\_con(txt, bigint\_as\_char) : parse error: trailing garbage  
k/drug/moclobemide.html"]}]} {“actionType”:“ANTAGONIST”,"mec  
(right here) ------^

---

<div class="post-metadata">

**Author:** ![ochoa](https://dub1.discourse-cdn.com/flex017/user_avatar/community.opentargets.org/ochoa/32/189_2.png) [@ochoa](https://community.opentargets.org/u/ochoa)\
**Post date:** [30 April 2021 18:18 UTC](https://community.opentargets.org/t/unable-to-parse-json-files/77/2 "2021-04-30T18:18:04Z")

</div>

If you are keen on R, I would suggest you to try with the sparklyr tutorial in [Documentation](https://platform-docs.opentargets.org/data-access/datasets). That should circumvent some of the issues you are having.

The main reason why this is not working for you, it’s that the files are in JSON lines not in JSON.

---

<div class="post-metadata">

**Author:** ![sigven](https://dub1.discourse-cdn.com/flex017/user_avatar/community.opentargets.org/sigven/32/36_2.png) [@sigven](https://community.opentargets.org/u/sigven)\
**Post date:** [30 April 2021 19:17 UTC](https://community.opentargets.org/t/unable-to-parse-json-files/77/3 "2021-04-30T19:17:27Z")

</div>

OK, thanks for the swift response. From the single example looking into ClinVar it is not clear how a similar approach should be modified for targets/molecules/drugs etc? In particular, I do not understand how the local downloads of the parquet files (which I assume is necessary for this to be working?) should be arranged?

What should be present/downloaded in “/Users/OpenTargetsUser/Datasets” for the example to work?

Although the spark approach is likely a convenient and efficient approach (my first time exposed to parquet, I must admit :-)), showing how the JSON data can be accessed or parsed would in my opinion be highly valuable to the community, considering that this is a well-established format.

---

<div class="post-metadata">

**Author:** ![sigven](https://dub1.discourse-cdn.com/flex017/user_avatar/community.opentargets.org/sigven/32/36_2.png) [@sigven](https://community.opentargets.org/u/sigven)\
**Post date:** [1 May 2021 07:01 UTC](https://community.opentargets.org/t/unable-to-parse-json-files/77/4 "2021-05-01T07:01:50Z")

</div>

Seems I now manage to load the JSON data in R (example with targets):

con ← file(‘targets-part-00000.json’,‘r’)  
target\_data ← jsonlite::stream\_in(con)
