Hi Davide,
On Thu, Feb 13, 2014 at 2:48 AM, Davide Giannella <[email protected]> wrote: > On 13/02/2014 10:22, Davide Giannella wrote: >> ... >> It will fire an http servlet from which I can post JSON payload for >> creating nodes but it manages all the nodes as String. >> > Sorry my bad. Wrong information. It won't treat all the items as string > but it doesn't consider the Date case > > https://github.com/apache/jackrabbit-oak/blob/trunk/oak-http/src/main/java/org/apache/jackrabbit/oak/http/OakServlet.java?source=c#L186 The problem is, that JSON does not really specify a date type. there are several way to solve this. 1) invent a way to transport the desired extended type. e.g. the @TypeHint mechanics of the sling post servlet, or include the type in the json value or name eg: { "lastModified": "1.1.1970", "lastModified@TypeHint": "Date", } or { "lastModified@Date": "1.1.1970", } or { "lastModified": "{Date}1.1.1970", } 2) try to parse the string value into a date..and assume it's date if parsing succeeds 3) use a nodetype with a property that is required to have a date type, eg add a mix:LastModified to your node and then use jcr:lastModified. Regards, Toby
