Hello,
I have an entity that uses both Joda LocalDate and LocalTime attributes. I’m
using ERRest to serialise these EOs.
LocalDate works fine under all circumstances. LocalTime seems to be serialising
to XML and plist correctly, but causes the JSON serialiser to lose its mind.
INFO net.sf.json.JSONObject - Property 'field' of class
org.joda.time.LocalTime has no read method. SKIPPED
INFO net.sf.json.JSONObject - Property 'fieldType' of class
org.joda.time.LocalTime has no read method. SKIPPED
INFO net.sf.json.JSONObject - Property 'millis' of class
org.joda.time.field.PreciseDurationField has no read method. SKIPPED
INFO net.sf.json.JSONObject - Property 'millis' of class
org.joda.time.field.PreciseDurationField has no read method. SKIPPED
INFO net.sf.json.JSONObject - Property 'millis' of class
org.joda.time.field.PreciseDurationField has no read method. SKIPPED
And so on. The output looks like this:
"endTime":{"chronology":{"zone":{"ID":"UTC","fixed":true}},"fieldTypes":[{"durationType":{"name":"hours"},"name":"hourOfDay","rangeDurationType":{"name":"days"}},{"durationType":{"name":"minutes"},"name":"minuteOfHour","rangeDurationType":{"name":"hours"}},{"durationType”:
...
Naturally, JSON is the output format I actually want.
What are my options here? I find it hard to believe that
NSPropertyListSerialization knows how to handle Joda LocalTime specifically, so
why is it getting the output right and the JSON serialiser isn’t? Is there an
easy way to add custom types to ERRest? It looks like LocalDate formatting is
handled in ERXRestUtils. Is that the only way to handle formatting a LocalTime?
(I probably won’t need two-way handling of these LocalTimes, so I could
actually add a cover method on the EO to format the value as a String. But it
would be nice if I could do this the Right Way.)
--
Paul Hoadley
http://logicsquad.net/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [email protected]