#install.packages("jsonlite")
# First of all we have to Load jsonlite package 
library(jsonlite) 
## Warning: 程辑包'jsonlite'是用R版本4.2.3 来建造的
dir_path <- "C:\\Users\\liyix\\OneDrive\\Desktop\\json\\"
dir_path_name <- list.files(pattern = ".*",dir_path,full.names = T, recursive = T)
#dir_path_name
# Then we have to load JSON data 
sample_data <- fromJSON(grep("resolver.json",dir_path_name,value = T)) 

# Then convert  the JSON data to dataframe 
output_dataframe <- as.data.frame(sample_data) 
dim(output_dataframe)
## [1] 99  7
#View(output_dataframe)
#head(output_dataframe,2)
length(unique(output_dataframe$input)) #99
## [1] 99
# At last print the output dataframe 
write.csv(output_dataframe, paste0(dir_path,Sys.Date(),"-","resolver.csv"),row.names = FALSE,na = "")
#ref https://www.geeksforgeeks.org/convert-json-data-to-dataframe-in-r/