1

I am going to create dynamic content web site with HTML5 + jQuery. Which data format is best to use for web site either XML or JSON

Thanks.

3
  • 1
    It rather depends on what you want to do with it, and even then will probably be open to some debate. Commented Aug 23, 2012 at 11:07
  • 1
    If you're going to use javascript, I think using javascript object notation (json) will be the easier way. Commented Aug 23, 2012 at 11:09
  • have to show latest works in the home page as images. later will change the latest work image url in our dynamic content file (XML/JSON). Commented Aug 23, 2012 at 11:14

1 Answer 1

3

Well:

If all you want to pass around are atomic values or lists or hashes of atomic values, JSON has many of the advantages of XML: it’s straightforwardly usable over the Internet, supports a wide variety of applications, it’s easy to write programs to process JSON, it has few optional features, it’s human-legible and reasonably clear, its design is formal and concise, JSON documents are easy to create, and it uses Unicode.

If you’re writing JavaScript in a web browser, JSON is a natural fit. The XML APIs in the browser are comparitively clumsy and the natural mapping from JavaScript objects to JSON eliminates the serialization issues that arise if you’re careless with XML.

One line of argument for JSON over XML is simplicity. If you mean it’s simpler to have a single data interchange format instead of two, that’s incontrovertibly the case. If you mean JSON is intrinsically simpler than XML, well, I’m not sure that’s so obvious. For bundles of atomic values, it’s a little simpler. And the JavaScript APIs are definitely simpler. But I’ve seen attempts to represent mixed content in JSON and simple they aren’t.

XML is more complex than necessary for Web Services. By default, XML requires you to use complex features that many Web Services do not need to be successful.

source: http://digitalbazaar.com/2010/11/22/json-vs-xml/

And I totally agree.

Sign up to request clarification or add additional context in comments.

5 Comments

And your first and last paragraph is a total contradiction to what XML is. XML works everywhere while JSON does not. Far more readable than JSON. I could go on and on but thinking JSON is a replacement for XML is a very narrow view and wrong.
I see you are just quoting that article which is totally short-sighted and wrong.
way too many words for a simple question but in essence completely correct ;-) @Rob: if you wanna take part in the discussion (or open one up) then you should provide arguments...
@JörnBerkefeld - I've built a complete ecommerce online ordering system for a large franchise restaurant chain using XML and XSLT that was wonderful but I'm far too busy to carry this discussion further.
@Rob - Kudos! And I had an Energy drink for breakfast this morning (completely w/o JSON or XML) =)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.