Reputation: 33
I have the following code:
data = list(
"id" = equip_id,
"initial_date" = 1608433200,
"final_date" = 1609038000,
"limit" = 10000,
"order" = "asc",
"properties" = "forecast"
)
If I use:
jsonlite::toJSON(data, auto_unbox = TRUE)
I have this:
{"id":3,"initial_date":1608433200,"final_date":1609038000,"limit":10000,"order":"asc","properties":"forecast"}
But what I want:
{"id":3,"initial_date":1608433200,"final_date":1609038000,"limit":10000,"order":"asc","properties":["forecast"]}
How can I edit manually which one are arrays or not?
Upvotes: 2
Views: 90
Reputation: 84659
Convert properties
to a list:
data = list(
"id" = equip_id,
"initial_date" = 1608433200,
"final_date" = 1609038000,
"limit" = 10000,
"order" = "asc",
"properties" = list("forecast")
)
Upvotes: 2