how to read json file in OECD?

Hi...
i have a url from OECD and I would like to read/download (https://sxs-boost-oecd.redpelicans.com/boost-disseminate/sdmx/boost-disseminate/v2/sdmx/dataflow/OECD.DCD.FSD/DSD_CRS@DF_CRS/1.3?references=all)

Hi @melgoussi, are you sure that the page is well.
Im try to test and show me {"message":"resource \"boost-disseminate\" is not an artefact name"}

can you visit this website
https://data-explorer.oecd.org/vis?tm=CRS&pg=0&snb=24&df[ds]=dsDisseminateFinalCloud&df[id]=DSD_CRS%40DF_CRS&df[ag]=OECD.DCD.FSD&df[vs]=1.3&dq=DAC..1000.100._T._T.D.Q._T..&lom=LASTNPERIODS&lo=5&to[TIME_PERIOD]=false

and click on Developer API and you will find Structure query.

Next to see a documentation, you could get the data from 2019 in this way.

# install.packages("httr")
# install.packages("jsonlite")
library(httr)
library(jsonlite)

# Built URL of the API 
base_url <- "https://sxs-boost-oecd.redpelicans.com/boost-disseminate/v2/sdmx/data"
endpoint <- "OECD.DCD.FSD,DSD_CRS@DF_CRS,1.3/DAC..1000.100._T._T.D.Q._T.."
params <- list(
  startPeriod = "2019",
  dimensionAtObservation = "AllDimensions")

url <- paste0(base_url, "/", endpoint)

# request HTTP
response <- GET(url, query = params) # 200

# Check respons
if (http_status(response)$category == "Success") {
  print("excellent request")
} else {
  stop("error request: ", http_status(response)$message)
}

# Processing JSON
json_data <- content(response, "text", encoding = "UTF-8")
data <- fromJSON(json_data, flatten = TRUE) # as a list

View(data) # 

Maybe you need filter the data list for get the result in a data frame with the principal data that you want.

1 Like