Hi, I'm mainly working with Python, but I decided to use R Shiny for a webapp project.
I've JSON file, I want to read it, and send to an API via POST request.
Example:
{
"txt_field": "bar",
"list_field": ["foo"],
"list_of_dicts": [{ "a": 42, "b": "b" }],
"list_of_lists": [[2,1,3,4], [3,4,1,2]]
}
The problem is when I use fromJSON, toJSON
functions the output is not the same as the initial JSON. txt_field
becomes an array "txt_field": ["bar"]
.
I'm not good at R but I think this about data types in R. Even the a string is 1 length vector with type character. So, I would like to know the reason behind this and more importantly how do I read the json and pass it to an API without changing the original structure.