R/import_survey.R

Defines functions import_survey

Documented in import_survey

#' Load json file
#' 
#' Leverage the survey creator here \url{https://surveyjs.io/create-survey}.
#'
#' @param path Path to json file containing the survey structure and flow.
#'
#' @return
#' @export
import_survey <- function(path) {
  
  survey_json <- jsonlite::read_json(path)
  survey_json <- jsonlite::toJSON(survey_json, auto_unbox = TRUE, pretty = TRUE)
  
  if (!jsonlite::validate(survey_json)) stop("Object does not contain valid json!")
  
  
  survey_json
}
dheimgartner/surveyjR documentation built on Feb. 5, 2022, 8:11 a.m.