|
Hello, Is there a SAS library that makes it possible to use a web API that only returns data in the JSON format? |
|
No. I asked the same around a year ago and that was the answer. Consider having SAS call a .NET or Java library, convert the data, then pump it back to SAS. If SAS has something now that supports it, I would love to know. |
Pure SAS JSONAll, this is a totally naive implementation of a pure SAS JSON parser . If you feed it a FILENAME ref pointing to a URL that generates JSON (preferrably on one line ... :) and a variable list (right now it has to be IN THE ORDER it shows up in the JSON). Its relatively robust for simple single- and multi-row datasets. Hierarchical data is not supported. You could probably take this and run with it to the hills and beyond if you wanted. In any case, the OP test JSON is parsed perfectly. In addition, you can call a normal Facebook Graph API url for an ID and get that data into a dataset as well. Output is a SAS dataset named "JSON" (shock).
Examples of calling itusing the originally posted test json string
This results in 3 records with the data specified in the OP sample. using Facebook Graph API
This results in one record with all of my facebook public info. As I've said, it's naive, assumes a lot via convention, needs to be expanded and more dynamic, etc. But for now, it handles BASIC json parsing. |