mercredi 4 mars 2015

Strange "new" property appearing after REST call using HTTPBuilder and Grails

I have a grails controller making a REST call using HTTPBuilder:



def getSettings(String customerID) {
def http = new HTTPBuilder( grailsApplication.config.com.company.product.productWebserviceURL )
def result = [:]
def postBody = [customerID: customerID]

try {
http.post(path: 'product/getSettings', body: postBody, requestContentType: URLENC) { resp, json ->
result = json
}
} catch (IOException ex) {
logger.error("Cannot in attempting to get settings via webservice for customerID: " + customerID + ". Is the server running? \nError: " + ex.getMessage())
result['errors'] = [[message : this.CUSTOMER_FACING_TRANSACTIONHISTORY_DOWN_MESSAGE]]
response.status = 500;
}
render result as JSON
}


Everything is fine, except when getting the JSON response, there is this new property called "new." Here is the Settings object about to be returned as JSON from my Spring backend:


Object about to be returned as JSON


And here it is as the JSON response in the grails controller:


After getting the response


Does anyone have an idea how this "new" property keeps getting added on?


Aucun commentaire:

Enregistrer un commentaire