I want to know how can I post json array directly to rails server. Say,
POST '/api/notes_bulk', HTTP/1.1
Content-Type: application/json
[{“content”:”content1”, “title”:”title1”}, {“content”:”content2”, “title”:”title2”}, {“content”:”content3”, “title”:”title3”}, {“content”:”content4”, “title”:”title4”}, {“content”:”content5”, “title”:”title5”}]
I did some search about it and all of the examples had some kind of key mapped to the array. While in my case, the json is an array at its top level.
How can I get the json data in the controller code? I notice that rails wraps this data with a "_json" key, but when I accessing it, it says
Unpermitted parameters: _json, ....