Thursday, December 8, 2011

Json is Strict

I have been using JSON as DTO (Data transfer Object) for quite some time.
Today while educating myself with jquery came across an interesting thing about it.

So far today I knew the following is valid, but i was wrong
{ id : '01', name: 'kris' } <= invalid

It should be

{ id : "01", name: "kris" } <= valid


Refer : http://json.org/ for more information

Extjs accepts the above invalid data but jquery doesn't (as far as i have educated myself in jquery).

Aint that interesting !!!