I've only recently heard about JSON (Javascript Object Notation). Can anybody explain why it is considered (by some websites/blogs/etc) to be important? We already have XML, why is JSON better (apart from being 'native to Javascript')?
Edit: Hmm, the main answer theme seems to be 'it is smaller'. However, the fact that it allows data fetching across domains, seems important to me. Or is this in practice not (yet) much used?
JSON is a wildly successful way of formatting data for several reasons. First, it's native to JavaScript, and it's used inside of JavaScript programs as JSON literals. You can also use JSON with other programming languages, so it's useful for data exchange between heterogeneous systems. Finally, it is human readable.
The most common use of JSON data and files is to read data from a server for a website or web application to display — and change data given the correct permissions. But, that is not the only thing it is used for. Computer applications, programs, mobile apps, and much more all use JSON files.
JSON is faster because it is designed specifically for data interchange. JSON encoding is terse, which requires less bytes for transit. JSON parsers are less complex, which requires less processing time and memory overhead. XML is slower, because it is designed for a lot more than just data interchange.
XML has several drawbacks:
Clearly it's not meant to replace XML completely. For JS based Web apps, its advantages can be useful.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With