How to read JSON into SPSS

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to read JSON into SPSS

albert_sun
is there a way to import JSON into SPSS?
Reply | Threaded
Open this post in threaded view
|

Re: How to read JSON into SPSS

Andy W
JSON is not necessarily a rectangular data format, so there won't always be a simple conversion from JSON to an SPSS dataset. You could write python code to create the data, but there are some R packages to convert JSON to data frames, e.g. https://cran.r-project.org/web/packages/jsonlite/vignettes/json-aaquickstart.html. You could import the json into an R dataframe, and then import it into SPSS using the "STATS GET R" command.

I have a few examples on my blog of parsing JSON that are the result of web API's in python. See https://andrewpwheeler.wordpress.com/2015/04/02/using-the-new-york-state-online-geocoding-api-with-python/ for one example. Those are good examples though of the data are not a simple rectangle, so I'm unsure how to coerce that to a dataset. (And I'm not sure how the R programs do this either.)
Andy W
apwheele@gmail.com
http://andrewpwheeler.wordpress.com/