Skip to content
Prev 374506 / 398513 Next

help with json data from the web into data frame in R

I didn't have that issue when using the link you offered:

library(jsonlite)
myJSON <- fromJSON( url("https://www.semantic-mediawiki.org/w/api.php?action=ask&query=%5B%5BCategory:City%5D%5D&format=json") )

# results in a complex list (not trivially reducible to a dataframe:

str(myJSON)
List of 1
 $ query:List of 5
  ..$ printrequests:'data.frame':	1 obs. of  5 variables:
  .. ..$ label : chr ""
  .. ..$ key   : chr ""
  .. ..$ redi  : chr ""
  .. ..$ typeid: chr "_wpg"
  .. ..$ mode  : int 2
  ..$ results      :List of 39
  .. ..$ File:2166320938 5cfc9ec72a z.jpg                      :List of 6
  .. .. ..$ printouts   : list()
  .. .. ..$ fulltext    : chr "File:2166320938 5cfc9ec72a z.jpg"
  .. .. ..$ fullurl     : chr "https://www.semantic-mediawiki.org/wiki/File:2166320938_5cfc9ec72a_z.jpg"
#-----trimmed-----------

David
David Winsemius
Alameda, CA, USA

'Any technology distinguishable from magic is insufficiently advanced.'   -Gehm's Corollary to Clarke's Third Law