Groups
Groups
Sign in
Groups
Groups
Lift
Conversations
About
Send feedback
Help
Getting Lift-Json to serialize java.sql.Date like java.util.Date
106 views
Skip to first unread message
Maxime Lévesque
unread,
May 29, 2013, 1:07:59 PM
5/29/13
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to liftweb
I'd like to get Lift-Json to
Getting Lift-Json to serialize java.sql.Date the same way as java.util.Date.
I use losslessDate serialization.
I'm aware that this implies that all dates will unserialize as
java.util.Date, and
I'm fine with that.
What is the best way to do this ?
THanks
--
Stability Is Destabilizing
-- Hyman Minsky
Joni Freeman
unread,
May 29, 2013, 2:44:46 PM
5/29/13
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to lif...@googlegroups.com
Hi,
You can define a custom serializer for unsupported types. Custom serializer for
java.sql.Date would probably be very similar to this:
https://github.com/lift/framework/blob/master/core/json-ext/src/main/scala/net/liftweb/json/ext/JodaTimeSerializer.scala#L65
Basically you define a pair of functions which know how to convert to/from JSON and
then register that serializer to your configuration:
implicit val formats = DefaultFormats ++ MyCustomSerializer
Cheers Joni
Maxime Lévesque
unread,
May 29, 2013, 4:11:14 PM
5/29/13
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to lif...@googlegroups.com
Thanks, that worksed beautifully !
Reply all
Reply to author
Forward
0 new messages