• Not at all, it really depends on your design. I certainly would not recommend it for every solution. Is storing and processing of XML data the best way to do accomplish a task? (Sometimes it can be.) I also use the function just in the database itself, stored procedures calling other stored procedures or functions.

    When doing a system design we consider ease of maintenance for the client, loads on different places in the system, volume of data, security and so forth. Does a AJAX call have to have the C# code process all the parameters into a stored procedure? Some designs require that more work is done in the database, rather than in the client or service portions of the code.

    Here are several examples where I felt the JSON format is useful.

    Example one, consider a web page that searches for authors and books. The page has input parameters for first name, last name and ISDN number. The page uses a AJAX call to a web method which creates the call into the stored procedure.

    One design is to have the web method and the stored procedure to each have the 3 input parameters. My method, using the function, allows us to have only one input parameter. The advantages are:

    1) the web method becomes very simple, maintenance is lower.

    2) if I need to add more parameters, like a book title, I need to only change the web page and the stored procedure. The web method does not need to change.

    3) validation of parameters need only take place in the stored procedure.

    Example two, the results consists of 20,000 records. I create a temporary table to store pointers to results, and have ranking, sort order, paging, and other parameters. The user gets 1 page of 20 records instead of all the records. I store the request criteria in the JSON format. The next time the same requests comes in I test to see if that result set has already been processed and, if so, return those results. This saves time because the search, and sorting does not have to be made again. Storing the criteria can be used for analysis reporting on the searches.

    Example three, occasionally I need to split string values into tables. This function allows this by surrounding the string with brackets. I eliminate having to have two split functions.

    Example four, storing application options and configuration, user preferences, security information. In some cases it is easier to store the information as a string rather than having many columns.