Friday, 2 May 2008

Comment Filtered JSON with Dojo

As you may or may not know, I'm working on a project at work using the Dojo JavaScript Framework. I have been working on the JSON examples. When I tried to use the standard xhr JSON handler for my JSON text, I got a message stating I should use Comment Filtered JSON instead.

So what the h*#l is comment filtered json? After must searching around and a little testing I finally figured it out. To prevent some other poor bastard from doing the same search, here is an example.
   1:{
2: "name":"South",
3: "type":"COED",
4: "size":200,
5: "students":["John Smith", "George Washington"]
6:}
7:
8:/*
9:{
10: "name":"South",
11: "type":"COED",
12: "size":200,
13: "students":["John Smith", "George Washington"]
14:}
15:*/


Lines 1 to 6 are regular JSON text. Lines 8 to 15 are comment filtered. To make JSON text comment filtered, simply put the text in a comment. That's it.

No comments:

Post a Comment