提取JSON数据库

时间:2015-08-06 21:43:54

标签: json xml r

我正在尝试从this page和与之关联的this is the specific json file检索数据。

我似乎无法提取有关设施的任何有意义的数据,似乎json文件只是一个没有观察的描述。

我正在尝试使用R包导入它。我试过JSON观众。第一个链接的文档页面似乎是XML格式。

1 个答案:

答案 0 :(得分:0)

从该网址获取数据:

library(jsonlite) #install these if need be
library(curl)
my_dat <- fromJSON('http://catalog.data.gov/harvest/object/5630b80a-23dc-483f-8164-876dac1a9757')

现在您有一个名为my_dat的列表,内容为

> my_dat
$`@type`
[1] "dcat:Dataset"

$accessLevel
[1] "public"

$bureauCode
[1] "029:40"

$contactPoint
$contactPoint$`@type`
[1] "vcard:Contact"

$contactPoint$fn
[1] "Kevin Reid"

$contactPoint$hasEmail
[1] "mailto:vawebservices@med.va.gov"


$description
[1] "The facilities web service provides VA facility information. The VA facilities locator is a feature that is available across the enterprise, on any webpage, for the Department of Veterans Affairs. It is comprised of data from across the different facilities, and is updated multiple times a day by multiple personnel. This API gives external users the ability to interact with the most up to date information about VA facilities."

$distribution
              @type                                                   accessURL format                      title
1 dcat:Distribution http://www.va.gov/webservices/fandl/documentation/fandl.cfm    API VA Facilities & Leadership

$identifier
[1] "VA-OIT-WSG-01"

$keyword
[1] "Building Information" "Facilities"           "Location"             "VA"  

如果这不是您期望的内容,那么这是数据源的问题。但这是一种从URL到R的摄取JSON的方法。