JSON

by kai on 10/03/2006



I’ve never heard about JSON until some weeks ago when I was reading an article on web services and data exchange that mentioned JSON. Actually it is a pretty cool mechanism to serialize complex data structures for data exchange or storage purposes.

I hear you saying…”Well, we have that in ColdFusion already, it’s called WDDX”. Right – good point. Let’s have a closer look:

– WDDX is built into ColdFusion by the CFWDDX tag but parsers are available for other technologies as well.
– WDDX is an XML language – so a cool standard somehow…

I can’t even say why, but I never really liked working with WDDX. It always seemed to be some sort of sluggish, slow stuff that I tried to avoid. And I’m pretty much aware of the fact that ColdFusion since MX 6, doesn’t have any performance issues with WDDX – no there should be any reason not to use it 🙂

The big advantage of JSON over WDDX should be that the format is way more lightweighted that XML or particularly WDDX. By the way: JSON is available for a huge range of languages as well.

In one very small project I was doing last month, I decided to give JSON a try and it really integrated smoothly without flaws. I used JSON to serialze a rather large nested struct of data and store it in a database. Same with deserializing – easy and smooth, no issues.

Just today we decided to use JSON to store data in another project with even more complex structures and I still like it.

In terms of performance: I was using the functions provided by the CFJSON project, and they performed awesome. If – for any reason they don’t work for you, you might want to give JSON for Java a try and just use the Java classes in CF.

David March 10, 2006 at 12:00 am

FYI, We just released AS3 libraries to parse JSON in Flex 2 as well. http://labs.macromedia.com/wiki/index.php/ActionScript_3:resources:apis:libraries#corelib

Regards,
David
Adobe

jehiah March 10, 2006 at 12:00 am

Glad you found my cfjson project usefull =)

John Farrar March 10, 2006 at 12:00 am

I have links to some cool tools on my blog for this technology. In fact I have also written a version of CF_JSON that translates the client side query structure back to a recordset when it comes back to CF!

http://www.sosensible.com

guidone March 14, 2006 at 12:00 am

Is it possible to use JSON either for data sent to and from the server?
I’m own ajax library I’ve used wddx to exchange data, in this way I’m free to use any kind of datatype for parameters to be passed to remote function and any kind for datatype to be returned to javascript.
Probably is slower than JSON but is more flexible.

Comments on this entry are closed.

Previous post:

Next post: