4

I've been searching through the web to look for a solution for this but still stuck.

I'm having difficulties serializing DateTime object. The standard serialize using DataContract will give this result /Date(1262600239000)/. After Ext.encode the result changed to /Date(1262600239000)/. The result from Ext.encode is not readable in ExtJS date related components such as DateField and ColumnModel for date.

As for deserializing, i'd have to provide the date in this /Date(1262600239000)/ format in order to deserialize the date. How can i achive this with the ExtJS DateField?

Is there any specific ways to get around this?

Thanks in advance.

asked Jan 6, 2010 at 4:55

2 Answers 2

2

You could try Newtonsoft Json.NET. It's open source and free (MIT license).

It is the one used by the Ext.Direct .NET Router which was developed by Evant (who is part of ExtJS Core Development Team).

You can see this code that uses it for a DateTime in the sample of Ext.Direct .NET Router:

[JsonObject]
public class Company {
 //...
 [JsonProperty(PropertyName = "started")]
 [JsonConverter(typeof(IsoDateTimeConverter))]
 public DateTime Started { get; set; }
 //...
}
answered Sep 16, 2010 at 22:57
1

Have you tried this?

It's an override for ExtJS' JSON encode and decode methods. Make sure to read the last comment as well.

answered Jan 6, 2010 at 5:06
1
  • i've tried this method and it works... but it gives another problem... The Ext.decode decodes my tree json incorrectly... As for reference this is my post in ExtJS Forum extjs.com/forum/showthread.php?p=424408#post424408 Commented Jan 6, 2010 at 6:33

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.