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 Good Gear Guide newsletter!

Error: Please check your email address.

Tags XMLjavascriptdata integrationJSON

Our Back to Business guide highlights the best products for you to boost your productivity at home, on the road, at the office, or in the classroom.

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

Most Popular Reviews

Latest News Articles


PCW Evaluation Team

Azadeh Williams

HP OfficeJet Pro 8730

A smarter way to print for busy small business owners, combining speedy printing with scanning and copying, making it easier to produce high quality documents and images at a touch of a button.

Andrew Grant

HP OfficeJet Pro 8730

I've had a multifunction printer in the office going on 10 years now. It was a neat bit of kit back in the day -- print, copy, scan, fax -- when printing over WiFi felt a bit like magic. It’s seen better days though and an upgrade’s well overdue. This HP OfficeJet Pro 8730 looks like it ticks all the same boxes: print, copy, scan, and fax. (Really? Does anyone fax anything any more? I guess it's good to know the facility’s there, just in case.) Printing over WiFi is more-or- less standard these days.

Ed Dawson

HP OfficeJet Pro 8730

As a freelance writer who is always on the go, I like my technology to be both efficient and effective so I can do my job well. The HP OfficeJet Pro 8730 Inkjet Printer ticks all the boxes in terms of form factor, performance and user interface.

Michael Hargreaves

Windows 10 for Business / Dell XPS 13

I’d happily recommend this touchscreen laptop and Windows 10 as a great way to get serious work done at a desk or on the road.

Aysha Strobbe

Windows 10 / HP Spectre x360

Ultimately, I think the Windows 10 environment is excellent for me as it caters for so many different uses. The inclusion of the Xbox app is also great for when you need some downtime too!

Mark Escubio

Windows 10 / Lenovo Yoga 910

For me, the Xbox Play Anywhere is a great new feature as it allows you to play your current Xbox games with higher resolutions and better graphics without forking out extra cash for another copy. Although available titles are still scarce, but I’m sure it will grow in time.

Featured Content

Latest Jobs

Don’t have an account? Sign up here

Don't have an account? Sign up now

Forgot password?