try {
// dates are sent to the client using a fixed format, the one returned by GeneralUtilities.getServerDateFormat()
SimpleDateFormat dateFormat = new SimpleDateFormat();
dateFormat.applyPattern(GeneralUtilities.getServerTimeStampFormat());
SubObject subObject = (SubObject) o;
result = new JSONObject();
result.put(ID, subObject.getId() );
result.put(NAME, subObject.getName() );
result.put(DESCRIPTION, subObject.getDescription() );
result.put(OWNER, subObject.getOwner() );
Date creationDate = subObject.getCreationDate();
String creationDateStr = dateFormat.format(creationDate);
result.put(CREATION_DATE, creationDateStr );
Date lastChangeDate = subObject.getLastChangeDate();
String lastChangeDateStr = dateFormat.format(lastChangeDate);
result.put(LAST_MODIFICATION_DATE, lastChangeDateStr );
result.put(VISIBILITY, subObject.getIsPublic() );
} catch (Throwable t) {
throw new SerializationException("An error occurred while serializing object: " + o, t);