Closed amplexdenmark closed 1 year ago
Doing so would be a breaking page pretty much to all existing JSON apps out there but we will gladly accept a PR that makes it opt-in.
Ok, I will consider that. I'm not that familiar with the inner workings of Plug and how config is passed around, so it will probably be a while before the PR :)
I believe the options given to Plug.Parsers is available to all parsers, so it could be something like nest_json_at: ...
. :)
Currently as documented non object JSON is wrapped in a Map with a
"_json"
key to the parsed content. But object JSON is returned as is.This leads to the situation that parsing:
{"_json":[]}
cannot be distinguished from parsing:[]
They both leads to the same result:
%{"_json" => []}
The fix is not to handle objects specially, but always return the parsed content in a Map with
"_json"
key.