The abillity to map toJson() method in order to match custom JSON object formatting. As it is available when mapping toArray() or the model itself. We are currently offered a way to hide or append values from and to the JSON response, however it is impossible to change the hierarchy of the JSON output and thus work with the function.
My proposal is to add the functionality to fully customize the hierarchy of the toJSON() output.
The issue is why use an external resource class when one can just override the toJSon or toArray method in the said model. Isn't that an extra overhead?
The abillity to map toJson() method in order to match custom JSON object formatting. As it is available when mapping toArray() or the model itself. We are currently offered a way to hide or append values from and to the JSON response, however it is impossible to change the hierarchy of the JSON output and thus work with the function.
My proposal is to add the functionality to fully customize the hierarchy of the toJSON() output.