Hi Demis,
what should I do to correctly deserialize that DateTime value on Linux?
Is that possible or do I have to parse the DateTime to a string before
serialization?
Thanks,
Francesco
class Program
{
public static void Main(string[] args)
{
var dateStr = JsonSerializer.SerializeToString(DateTime.Now);
var now = JsonSerializer.DeserializeFromString<DateTime>(dateStr); //long form
Console.WriteLine(now);
}
}
function date(s) {
return new Date(parseFloat(/Date\(([^)]+)\)/.exec(s)[1]));
}
Ooops I forgot to say that I am not using ASP.NET...
maybe I was not clear while explaining my problem.
I have a DTO with a DateTime field that is populated in my application.
Then I call a GET method and the JSON that I receive contains the
escape "\" charachters.
When I'm parsing that JSON on linux (no asp.net) I receive that date
format with escape charachters.
How do I serialize a date field in JSON let's say in UTC format?
Do I have to change my DTO field to String and then convert DateTime
to String before serializing the JSON?
Thank you,
Francesco
the application that is consuming the ReST WS is a Java/Groovy app.
Sorry but I didn't say it before.
How can I use your C# JSON serializer/deserializer lib in my app?
Thanks a lot,
Francesco
Date expiry = new Date(timeInMs);
Unfortunately I work in a team...and I have a weird collegue who is
against every thing is MS and he doesn't want to parse anything.
Working in a team may me hard sometimes :)
So I am going to pass an UTC string...but in the end he will have to
parse it anyway!
Ciao,
Francesco