[ https://issues.apache.org/jira/browse/GEODE-226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16164514#comment-16164514 ]
Rupert St John Webster commented on GEODE-226: ---------------------------------------------- It would be nice to have Json date support per [5 laws for API dates|http://apiux.com/2013/03/20/5-laws-api-dates-and-times/] and [the right json format|https://stackoverflow.com/questions/10286204/the-right-json-date-format] by which the thing to go for is JavaScript built-in JSON object format, or "2012-04-23T18:25:43.511Z". I think people need to be able to access millisecond precision at least... > JSON seems to lose time portion on getObject > -------------------------------------------- > > Key: GEODE-226 > URL: https://issues.apache.org/jira/browse/GEODE-226 > Project: Geode > Issue Type: Bug > Components: serialization > Reporter: Konstantin Ignatyev > Assignee: Hitesh Khamesra > > com.gemstone.gemfire.pdx.internal.PdxInstanceImpl#getObject > Date format, in the JSON land it is pretty much settled to be ISO 8661 > https://weblog.west-wind.com/posts/2014/Jan/06/JavaScript-JSON-Date-Parsing-and-real-Dates > > It would be nice to be able to have Geode’s JSON standard compliant, or have > this configurable. Otherwise the we will be loosing time portion of date-s > public Object getObject() { > if (getPdxType().getNoDomainClass()) { > //In case of Developer Rest APIs, All PdxInstances converted from Json > will have a className =__GEMFIRE_JSON. > //Following code added to convert Json/PdxInstance into the Java object. > if(this.getClassName().equals("__GEMFIRE_JSON")){ > > //introspect the JSON, does the @type meta-data exist. > String className = extractTypeMetaData(); > > if(StringUtils.hasText(className)) { > try { > ObjectMapper mapper = new ObjectMapper(); > mapper.setDateFormat(new SimpleDateFormat("MM/dd/yyyy")); > mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, > false); > > mapper.configure(com.fasterxml.jackson.core.JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, > true); > String JSON = JSONFormatter.toJSON(this); > Object classInstance = mapper.readValue(JSON, > ClassPathLoader.getLatest().forName(className)); > return classInstance; > }catch(Exception e){ > throw new PdxSerializationException("Could not deserialize as java > class type could not resolved", e); > } > } > } > return this; > } > Also this method is not that performant, please see #225 -- This message was sent by Atlassian JIRA (v6.4.14#64029)