Hello,
I started with Plumber today and it is working great. When the JSON is flat, it works exactly as expected.
How does Plumber deal with JSON that is nested and multi-layered? How would I craft the function in this manner?
Am I to understand that I have to flatten the structure before i send it over?
Thanks
I don't understand what you mean. There's no difference between __flat JSON__ and __multi-layered JSON__, in my opinion. An example may help to understand.
I was about to ask the same question (I think) so I decided to comment here.
In my case, the application requires that the fromJSON
call has the flatten
flag set to TRUE
. Using Plumber
, I'm unable to use the parsed args directly because there is no way to specify that. Alternatively, I use req$postBody
with my own parsing.
I checked the code and it seems that there is not way to configure that. safeFromJSON
function accepts args
that are then passed to jsonlite::fromJSON
call but the parseBody
function doesn't take advantage of that.
Maybe adding a way to set custom settings for the default filters?
Closing due to inactivity
As a note, plumber
can parse any valid JSON structure and can also return very complicated JSON structures.