My previous effort to think clearly about how I want to design an ASP.NET server application (with its off-putting angry undertones) mentioned JSON (again). My respect for Yahoo’s Douglas Crockford may go unnoticed because of my XML bias. But I am actually using JSON—in the very same application that appears to be “avoiding” JSON.
Admittedly I turned to JSON when I wanted to send a flattened version of my Quiz Storyboard to the Client. I want the Client to store the identifiers for every Storyboard resource that is to appear. This information is represented as an array of object literals.
My designing tells me that the Client can either request XML (the X in AJAX) or JSON—it can’t ask for both. I was writing the previous sentence being fully aware of JsonML. So (until I find a comfortable way to use something like JsonML) I ‘cheated’ by writing JSON into the initial (and only) ASP.NET forms page (the Client) as a
script block. Then the Client uses Douglas Crockford’s JSON parser to get me my array of Storyboard resources.
So I am actually using JSON—but not with AJAX… Okay, here is a small table of JSON-related links:
|“JsonML (JSON Markup Language)”||I was in a hurry and tried this quickly by using their XSL template with my domain-specific XML. The XSL transformation was too slow and I dropped it. I’ll probably get back to this later.|
|“XML.com: Converting Between XML and JSON”||“On the client-side, JSON comes with a native language-compliant data structure, with which it performs much better than corresponding DOM calls required for XML processing.” I have not found the need to “process” XML on the client. This is why I have not been ‘encouraged’ to try more JSON stuff.|
|“How to convert XML to JSON in ASP.NET C#”||Just a little “proof” that .NET people find this JSON stuff worthwhile.|
|“JSON and Browser Security » Yahoo! User Interface Blog”||Douglas Crockford might be talking to me: “This pain can be avoided by adopting good practices. Often, so-called experts seem to be incapable of distinguishing the good practices from the bad ones, so there is a lot of bad advice available on the web.”|
|“Understanding JSON: Why JSON and XML are Incompatible and Why You Should Care”||
M. David Peterson: “People need to be aware of the whole JSON hype and not be easily lured into substituting it for the stable and proven useful by years of practical experience XML document representation.”
“Any claims of better readability of JSON become obviously wrong for any but the smallest size JSON objects.”
|“InfoQ: Debate: JSON vs. XML as a data interchange format”||“The bottom line argument for JSON comes down to elegance—it does what is does simply and cleanly, and simply refuses to worry about many of the things that complicate XML such as metadata (attributes), comments, processing instructions, a schema language, and namespaces.”|