bigQueryR
                                
                                 bigQueryR copied to clipboard
                                
                                    bigQueryR copied to clipboard
                            
                            
                            
                        Create a BigQuery table with geoJSON files doesn't work
I'd like to create a BigQuery table with geoJSON files, despite the geoJSON is an accepted format in BQ and sourceFormat specification is coercible to  (NEWLINE_DELIMITED_JSON) in the function bqr_upload_data() of the bigQueryR package doesn't work. In my example below the output, error is: Error in UseMethod("bqr_do_upload", upload_data) : 
library(sf)
library(geojsonsf)
library(bigQueryR)
# get AOI in shapefile
download.file(
  "https://github.com/Leprechault/trash/raw/main/sel_stands_CMPC.zip",
  zip_path <- tempfile(fileext = ".zip")
)
unzip(zip_path, exdir = tempdir())
# Open the file
setwd(tempdir())
stands_sel <- st_read("sel_stands_CMPC.shp")
# Reading layer `sel_stands_CMPC' from data source `C:\Users\fores\AppData\Local\Temp\Rtmp6l1bGx\sel_stands_CMPC.shp' using driver `ESRI Shapefile'
# Simple feature collection with 2 features and 16 fields
# Geometry type: MULTIPOLYGON
# Dimension:     XY
# Bounding box:  xmin: -52.3284 ymin: -30.43305 xmax: -51.21323 ymax: -30.35118
# Geodetic CRS:  GCS_unknown
# Open as geoJSON
geo <- sf_geojson(stands_sel)
str(geo)
# 'geojson' chr "{\"type\":\"FeatureCollection\",\"features\":[{\"type\":\"Feature\",\"properties\":{\"CD_USO_SOL\":2433.0,\"ID_"| __truncated__
projectid <-'[my-project]'
datasetid <-'stands_ROI_2021'
tableid <- 'CF_2021'
bqr_upload_data(projectId = projectid, 
datasetId = datasetid, 
tableId = tableid,
geo, 
#writeDisposition = c("WRITE_TRUNCATE", "WRITE_APPEND", "WRITE_EMPTY"), 
sourceFormat = c("NEWLINE_DELIMITED_JSON"))
Error in UseMethod("bqr_do_upload", upload_data) :
  method not applicable for 'upload_bqr' applied to an object of class "c('geojson', 'json')"
Please, any help for fix it?
It needs to be an R list, data.frame or a file saved to disk or GoogleCloudStorage. Can you coerce your geojson object to one of those?
Thanks @MarkEdmondson1234 my file is like a JSON ({\"type\":\"FeatureCollection\",\"features\":[{\"type\":\"Feature\",\"properties\":{\"CD_USO_SOL) and I considering as list.
The class of the r object should be a list, eg class(x) should include "list" not "json".
Perhaps jsonlite::fromJSON() will convert it to a list.