Having an issue with the JSON output format and date/time formatting.

What I've gathered from the internet (?) is that JSON doesn't
prescribe a formatting for date/time objects up until May 26 2011 [1],
and now recommends date/times to be formatted as ISO 8601 dates
<http://www.w3.org/TR/NOTE-datetime>

Customer is requiring date/times to be formatted as per as ISO 8601

Fix would be easy:
--- a/wfs/src/main/java/org/geoserver/wfs/response/GeoJSONBuilder.java
+++ b/wfs/src/main/java/org/geoserver/wfs/response/GeoJSONBuilder.java
@@ -250,4 +251,14 @@ public class GeoJSONBuilder extends JSONBuilder {
                 "Unable to determine geometry type " + geometry.getClass());
         }
     }
+
+
+    @Override
+    public GeoJSONBuilder value(Object value){
+        if(value instanceof java.util.Date){
+          value = Converters.convert(value, String.class);
+        }
+        super.value(value);
+        return this;
+    }


Any objection?

[1] <http://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.23>


-- 
Gabriel Roldan
OpenGeo - http://opengeo.org
Expert service straight from the developers.

------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn 
about Cisco certifications, training, and career opportunities. 
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
Geoserver-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Reply via email to