JSON data interchange format gets standards blessing

Ecma approves the format, which offers an alternative to XML

An up-and-coming lightweight data interchange format for Web applications, considered by a growing number of people to be an alternative to XML, has gotten a boost from the standards body Ecma.

The Ecma General Assembly has approved the fifth edition of ECMAScript (PDF), according to Istvan Sebestyen, secretary general of the organization. Included in this new version of ECMAScript, of which the popular JavaScript is a dialect, is native support for using JavaScript Object Notation (JSON).

This inclusion "will certainly have a big impact on developers," said Douglas Crockford, the Yahoo software architect cited as the creator of JSON.

"JSON is already pretty widely-used in Web applications. By having JSON built into the ECMAScript language, [JSON] implementations will get faster and safer," Crockford said.

The approval is also a sign that the Web application development community is edging away from using XML as the sole desired standard for exchanging data among disparate systems, in at least those cases where delivery of relatively simple structured data is required.

The new standard, officially entitled ECMA-262, includes an object for both creating and parsing JSON texts. For the most part, it follows the 2006 Internet Engineering Task Force RFC 4627 authored by Crockford.

The new ECMAScript standard attempts to rectify a number of security issues surrounding JSON.

Over the past several years, a growing number of Web application developers used JSON instead of XML-based approaches, like the Simple Object Access Protocol, to mark up data so it can be transferred between two computers. This created two sometimes-opposing camps within the Web application development community.

"The split between the JSON and XML advocates is strong and will continue for the foreseeable future," said Daniel Markham, an Ajax architect and principal partner of the Virginia-based consulting firm Bedford Technology Group.

Advocates have praised JSON for its simplicity. According to the RFC, JSON was specifically developed to handle "the serialization of structured data." JSON is a set of conventions, or a grammar, on how to order the data to be transmitted so it can be parsed by the recipient. It borrows JavaScript's rules for formatting objects and arrays.

In contrast, XML relies on schema-based markup tags, which tend to make the datasets larger and more complex than those typically rendered in JSON.

"I'm an overall fan of JSON over XML, mainly because XML has a lot of syntactic fluff you have to dig through to get anything useful out of it. There's just an extra cognitive load that you don't have if your JavaScript objects match up closely with your server entities," Markham said.

Markham also noted that XML has a flexibility that JSON can't match. "XML remains the Swiss Army knife of the Internet: able to handle all sorts of data from any connector," he said.

Crockford formulated JSON in 2001 when working on a number of Web applications using the Ajax set of web development tools, which includes JavaScript, XML and HTML. He found XML to be too bulky for his needs.

"XML was just inexcusably ugly and inefficient, and so we came up with using JavaScript's own data representation to represent the data," Crockford said. Crockford is widely cited as being the inventor of JSON, though he is modest about assuming this appellative. "It already existed in nature. I just discovered it," he said.

Since its creation in 2001, JSON has grown in popularity. The JSON.org site lists a number JSON converters for languages such as Perl, Active Server Pages, PHP, C, Java, Python and others. Yahoo supports JSON for its Web services.

The latest versions of Internet Explorer and Firefox both have JSON support. JSON "looks like it will be the first bit of ECMAScript 5 that will be rolled out universally," Crockford said.

JSON itself has always been a part of ECMAScript, at least insofar as Crockford used ECMAScript grammar as the basis for JSON. The difference with ECMAScript 5, Crockford noted, is that ECMAScript has "built-in library support" for JSON. This will help in matters of security.

Most developers used the JavaScript eval() function to parse JSON-based text into usable data structures. Security professionals see this approach as a security flaw, because this form of input could allow third-parties to insert malicious code. The new parser eliminates the need to use the eval() function, Crockford said.

Tim Bray, a co-creator of the XML format and director of Web technologies at Sun Microsystems, noted that XML practitioners he has worked with see the value of JSON.

"XML has a bunch of features which make it possible to interchange documents (blog pieces, news releases, medical records), and these can be superfluous for interchanging pure data," he noted by e-mail. "JSON works really well for interchanging that kind of stuff and, like XML, is nicely vendor-independent."

Bray doubts the ECMA blessing will have much impact on further JSON adoption though, since it is already widely used and doesn't suffer from the interoperability problems that standards usually address.

"Obviously, there's no harm in the ECMAScript [revision] recognizing the reality of JSON [but] JSON is already deeply implanted in Web IT culture."

ECMAScript is the vendor-neutral version of the JavaScript programming language, which was originally created by Netscape as a scripting language for Web browsers.

Join the newsletter!

Error: Please check your email address.
Rocket to Success - Your 10 Tips for Smarter ERP System Selection

Tags javascriptXMLdata integrationJSON

Keep up with the latest tech news, reviews and previews by subscribing to the Good Gear Guide newsletter.

Joab Jackson

IDG News Service
Show Comments

Cool Tech

Breitling Superocean Heritage Chronographe 44

Learn more >

SanDisk MicroSDXC™ for Nintendo® Switch™

Learn more >

Toys for Boys

Family Friendly

Panasonic 4K UHD Blu-Ray Player and Full HD Recorder with Netflix - UBT1GL-K

Learn more >

Stocking Stuffer

Razer DeathAdder Expert Ergonomic Gaming Mouse

Learn more >

Christmas Gift Guide

Click for more ›

Most Popular Reviews

Latest Articles

Resources

PCW Evaluation Team

Edwina Hargreaves

WD My Cloud Home

I would recommend this device for families and small businesses who want one safe place to store all their important digital content and a way to easily share it with friends, family, business partners, or customers.

Walid Mikhael

Brother QL-820NWB Professional Label Printer

It’s easy to set up, it’s compact and quiet when printing and to top if off, the print quality is excellent. This is hands down the best printer I’ve used for printing labels.

Ben Ramsden

Sharp PN-40TC1 Huddle Board

Brainstorming, innovation, problem solving, and negotiation have all become much more productive and valuable if people can easily collaborate in real time with minimal friction.

Sarah Ieroianni

Brother QL-820NWB Professional Label Printer

The print quality also does not disappoint, it’s clear, bold, doesn’t smudge and the text is perfectly sized.

Ratchada Dunn

Sharp PN-40TC1 Huddle Board

The Huddle Board’s built in program; Sharp Touch Viewing software allows us to easily manipulate and edit our documents (jpegs and PDFs) all at the same time on the dashboard.

George Khoury

Sharp PN-40TC1 Huddle Board

The biggest perks for me would be that it comes with easy to use and comprehensive programs that make the collaboration process a whole lot more intuitive and organic

Featured Content

Product Launch Showcase

Latest Jobs

Don’t have an account? Sign up here

Don't have an account? Sign up now

Forgot password?