What is XML?

Extensible Markup Language (XML) is simple to read. It's a flexible text format derived from SGML (ISO 8879). Originally designed to meet the challenges of large-scale electronic publishing, XML was the gold standard for data exchange on the Web and elsewhere

Simple XML might look like this:

<?xml version="1.0" encoding="windows-1252" standalone="yes"?>
<Records>
<Record>
<Row A="first" B="surname" C="website" />
</Record>
<Record>
<Row A="Nick" B="Litten" C="www.nicklitten.com" />
</Record>
<Records>

Pros:

  • Mark-up code of XML is easy to understand for a human; it is possible to create "dialects" for any kind of purpose
  • XML is an extensible markup language like HTML
  • XML tags are not predefined. You need to define your customized tags
  • XML Schema for datatype, structure validation. Makes it also possible to create new datatypes
  • built in support for namespaces

Cons:

  • Relatively wordy compared to JSON (results in more data for the same amount of information)

What is JSON?

JavaScript Object Notation or JSON (/JAY-sən), is an open-standard file format that uses human-readable text to transmit data objects consisting of attribute–value pairs and array data types. It is a very common data format used for asynchronous browser/server communication, including as a replacement for XML in some AJAX-style systems.

Data types in JSON include string, number, boolean, array

Simple Json might look like this:

{"name": "Nick","surname": "Litten", "website": "www.nicklitten.com"}

Pros:

  • Simple syntax, which results in less "markup" overhead compared to XML.
  • Easy to use with JavaScript as the markup is a subset of JS object literal notation and has the same basic data types as JavaScript.
  • JSON Schema for description and datatype and structure validation
  • JsonPath for extracting information in deeply nested structures

Cons:

  • Simple syntax, only a handful of different data types are supported.

  • No support for comments


{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}
Pen
>