| By Dave Ward | Article Rating: |
|
| July 20, 2009 05:00 PM EDT | Reads: |
1,275 |
When you’re working with JSON, performance and security are often opposing, yet equally important concerns. One of these areas of contention is handling the JSON strings returned by a server. Most JavaScript libraries do a great job of abstracting away the details, but the underlying process has long been a frustrating exercise in compromise.
On one hand, eval() is the fastest widely available method, but it is not safe.
On the other hand, textual JSON parsers written in JavaScript may be much safer, but are dramatically slower. In client-side situations, where milliseconds count, such a large performance overhead is typically too prohibitive to accept.
Recently, an exciting new alternative has emerged: browser-native JSON parsing. Integrating JSON parsing as part of the browser’s implementation of JavaScript allows for using the more secure parsing method, and even provides performance faster than eval() offers.
To take advantage of that, this post will show you how to detect whether or not a browser supports native JSON parsing, and how to force jQuery to use browser-native parsing in its $.ajax calls when it is available.
Click here to continue reading: Improving jQuery's JSON performance and security
Published July 20, 2009 Reads 1,275
Copyright © 2009 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Dave Ward
Dave Ward wrote his first computer program in 1981, using good ‘ol Microsoft Color BASIC and cassette tapes for data storage. Over the years since then, he has had the opportunity to work on projects ranging from simple DOS applications to global telecommunications networks spanning multiple platforms.
- A Sneak Peak at ASP.NET AJAX 4.0’s Client-Side Templating
- Simplify Calling ASP.NET AJAX Services From jQuery
- Improving jQuery’s JSON Performance and Security
- $(document).ready() and pageLoad() are not the same!
- Automatically minify and combine JavaScript in Visual Studio
- How I handle JSON dates returned by ASP.NET AJAX
- Use jQuery to catch and display ASP.NET AJAX service errors
- 11 keystrokes that made my jQuery selector run 10x faster
- Highslide JS .NET v4.1.4
- Review: The best JavaScript book I’ve read
- PostBack Ritalin v1.0
- What ASP.NET developers should know about jQuery
























