grails-json-rest-api icon indicating copy to clipboard operation
grails-json-rest-api copied to clipboard

Extra "properties" attribute in JSON response

Open gpothier opened this issue 12 years ago • 1 comments
trafficstars

Hi, I just installed the plugin and found something weird in the JSON response for a given entity:

{"success":true,"data":{"aggregates":null,"attached":true,"categories":[],"errors":{"errors":[]},"id":1,"longDescription":"asef","modifiers":null,"name":"ert","properties":{"longDescription":"asef","aggregates":null,"typeId":null,"type":null,"modifiers":null,"categories":[],"aggregatesId":null,"modifiersId":null,"name":"ert","shortDescription":"ert"},"shortDescription":"ert","type":null}}

As you can see, there is a "properties" attribute that contains a duplicate of all the properties of the domain object.

gpothier avatar Dec 30 '12 15:12 gpothier

That is a Grails artifact which is included as part of the default JSON rendering. Use the 'excludedFields' parameter to exclude this. See http://www.grails.org/plugin/json-rest-api .

kentbutler avatar Mar 05 '13 08:03 kentbutler