Dates and JSON


JSON (JavaScript Object Notation) is a lightweight text-based open standard designed for human-readable data interchange (source: Wikipedia).

JSON is so very handy but one thing I hate about JSON is that its spec is so lightweight that it sometimes lacks some details on specific areas such as for dates. Scott Hanselman’s post “On the nightmare that is JSON Dates. Plus, JSON.NET and ASP.NET Web API”, is actually a perfect example of the kind of troubles you run into when building web sites and using various JSON serializers.

We bumped into this as we’re working on the next version of our ASP.NET Web Producer which will ship with an Ajax web site template (JQuery + JqGrid + JSON/REST) allowing developers to generate business oriented web apps (see our roadmap post for more info on this subject).

Anyway, when developing a business web site we, developers, have to support dates and since their format can vary in JSON, our JSON serializer/deserializer class (named JsonUtilities) supports several:

So if ever you need to support several date formats without having to switch JSON serializers/deserializers for each scenario, keep this JsonUtilities class in a corner as I’m sure it’ll come handy.

By the way, this JsonUtilities class is shipped as part of a free NuGet package, independently from our product, named CodeFluentRuntimeClient.

Here’s it’s web page if you want to try it out (http://nuget.org/packages/CodeFluentRuntimeClient) and here’s a post containing some serialization examples (JsonUtilities – Part 2) Winking smile

 

Cheers,

Carl Anderson

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 49 other followers