JSON Data Missed Columns in R , only 64 columns allowed!

I scraped a Jason file from web

json_file <- "https://example.com/race=21325&state=declare&advanced_analysis=1&page=1"
json_data <- fromJSON(json_file)

The data from from json as following link:


It shows in console with 315 columns, but when I check it with


it shows only 64 column in data set, I can't copy, select data in column 65-315. Any ideas about this problem ?


Unfortunately, neither of your datasets seem to be able to load when I try

> json_file <- "https://example.com/race=21325&state=declare&advanced_analysis=1&page=1"
> json_data <- fromJSON(json_file)
Error in open.connection(con, "rb") : HTTP error 404.

> json_data <- fromJSON("D:/Desktop/json_data.txt")
Error in parse_con(txt, bigint_as_char) : 
  lexical error: invalid char in json text.
                                       id	race_id horse_id house_id tr
                     (right here) ------^

Please see if you can fix this, and let me know. I'll be happy to look at it again


@dicklim39 we don't have access to the original data so it is difficult for us to help you.
The file you share in txt file is not an export of json_data in json or a tabular format that we can load easily.

by default, fromJSON will do automatic conversion to data.frame. You can try to import your json file to list then manipulate by end.

Other hint: your url seems to be paginated. You may need to use this pagination to get all the record. Some packages have tool to deal with API pagination like in crul or httr advice.

Hope it helps

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.