Question about JSON formatting for Editor and REST API
Question about JSON formatting for Editor and REST API
Hello, I'm currently trying to use the Editor functionality with an in-house REST API that uses Grails. I was wondering about how to format the JSON payload data from Editor functions like Create, Edit, and Delete.
The issue we are having seems to be from the way that the Editor formats the JSON data when you commit to an action. I've been using this as my example: https://editor.datatables.net/examples/advanced/REST.html
In the Ajax submitted data tab when using the example, Editor seems to have an outer layer label called "data" (data[yourkey]). This will not currently work with the way that Grails parse JSON strings, so is there any way to customize the JSON payload to remove the "data" label?
Answers
I'm wondering the same thing coming from an ASP.NET Web API. I can work around it, but there must be an easier way.
You can use the
ajax.data
option as a function to modify the data that Editor has prepared to send to the server into any other format that you wish, including flattening the object, re-naming parameters and adding new ones if you need.Regards,
Allan