Try adding as.character
to the end of your toJSON
pipe:
my_proposal <- tibble(a = "foo", b = "bar") %>%
jsonlite::toJSON() %>%
as.character()
Two other notes:
- Your SQL statement is also missing the
proposal
colname name in the INSERT list of columns. - This seems like a good use of PostgreSQL parameterization, in which case you'd write something like:
dbSendStatement(conn, "INSERT INTO proposal_table (prop_id, created_by, prop) VALUES ($1, $2, $3)", list(my_id, my_name, my_prop)