JSON Syntax Checker Tool

Yesterday I found a useful tool for checking the syntax of JavaScript Object Notation strings: http://www.raboof.com/Projects/JsonChecker/ I needed that because I'm trying to create a widget for Stickam that will work in my compiled help file. I'm using my xml2json generic handler to convert XML to JSON and apparently it generated some invalid JSON. This tool helped me to narrow down the location of the syntax error.

I need to make some improvements to my xml2json generic handler. First it needs to surround the JSON string with parentheses to prevent the infamous invalid label error. Second it needs to output the JSON string to a text file so I can debug errors caused by invalid syntax (trace listeners don't seem to work in generic handlers). And third it needs to use regular expressions to replace bad JSON syntax with an empty string. I should probably build in the JSON Checker code and return an error message about bad syntax.

I have come across the JavaScriptSerializer class in the System.Web.Script.Serialization namespace but it cannot serialize XML or DataSets.

Working with JavaScript Object Notation is currently quite painful. I think programmers need better tools for working with JSON. We need tools to check the syntax and visualize the data or objects it represents because JSON strings are very cryptic.

No Comments