NemanjaMandic / json-simple

Automatically exported from code.google.com/p/json-simple
Apache License 2.0
0 stars 0 forks source link

Patch to add JSONFormatter #35

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,

Not sure if this is the best way to submit this..  I added a simple mechanism 
to add formatters to types.  Our need is that we always want dates formatted in 
a specific way.

Usage is simple, just register the formatter with JSONValue. 

ex:

JSONValue.registerFormatter(Date.class, new JSONFormatter() {
 @Override
 public String toJSONString(Object value) {
  return ((Date)value).toGMTString();
  }
}); 

Original issue reported on code.google.com by dust...@gmail.com on 29 Dec 2010 at 10:31

Attachments:

GoogleCodeExporter commented 9 years ago
sorry, missed the JSONFormatter interface in the patch.  attached below

Original comment by dust...@gmail.com on 29 Dec 2010 at 10:33

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by jon.cham...@gmail.com on 10 Aug 2013 at 3:47