Is parsing JSON faster than parsing XML

Posted by geme_hendrix on Stack Overflow See other posts from Stack Overflow or by geme_hendrix
Published on 2011-01-04T17:20:13Z Indexed on 2011/01/04 17:53 UTC
Read the original article Hit count: 836

Filed under:
|
|

I'm creating a sophisticated JavaScript library for working with my company's server side framework.

The server side framework encodes its data to a simple XML format. There's no fancy namespacing or anything like that.

Ideally I'd like to parse all of the data in the browser as JSON. However, if I do this I need to rewrite some of the server side code to also spit out JSON. This is a pain because we have public APIs that I can't easily change.

What I'm really concerned about here is performance in the browser of parsing JSON versus XML. Is there really a big difference to be concerned about? Or should I exclusively go for JSON? Does anyone have any experience or benchmarks in the performance difference between the two?

I realize that most modern web developers would probably opt for JSON and I can see why. However, I really am just interested in performance. If there's a proven massive difference then I'm prepared to spend the extra effort in generating JSON server side for the client.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about Xml