I need to convert an object that I receive from a java method to Json, then I need to add a value. I was trying to do this but the value is not added.
Background:
* def jsonReport = json
* def getDate =
"""
function() {
var DateTimeFormatter = Java.type('java.time.format.DateTimeFormatter');
var dtf = DateTimeFormatter.ofPattern('uuuuMMddHHmmss');
var ldt = java.time.LocalDateTime.now();
return ldt.format(dtf);
}
"""
* def localDateTime = getDate()
* eval if(!jsonReport.Date) jsonReport.Date = localDateTime + ''