DESCRIBING DATA

data_path_with_glow_by_roos_skywalker-d5ju49z

This week’s DITA topic has been an introduction about XML and JSON. API designers use these two formats for exchanging data between their servers and client developers.

XML stands for Extensible Markup Language. It was designed to describe data and basically is information wrapped in tags. It is not a replacement for HTML but a complement to it.

While HTML displays data and allows only to use the tags that are already defined in the HTML standard, XML describes data and allows us to define our own tags. The tags and the document structure can be created by the author of the XML document.

The data in XML is stored in plain text format which makes it much easier to create data that can be shared by different applications. It makes the data more available.

This is an example of a XML document:

preview7

XML documents form a tree structure. They contain a root element which is the ‘parent‘ of the other elements. The terms ‘parent, child, and sibling‘ are used to describe the relationships between elements.

In our example, the root element is ‘video’ and this root element has five ‘children‘ who are ‘title, director, length, format and rating’.

JSON stands for JavaScript object notation which is a syntax for storing and exchanging data. It is a lightweight data interchange format. It shares some characteristics with XML (plain text, self-describing, hierarchical) but JSON is faster and easier. It doesn’t use end tags, it is shorter and easier to read and write. While XML is document-oriented and a better document exchange format, JSON is data-oriented and a better data exchange format.

JSON data is written as name/value pairs. A name/value pair consists of a field name (in double quotes), followed by a colon, followed by a value (also in double quotes).

Curly braces hold objects which can contain multiple name/values pairs and square brackets hold arrays which can contain multiple objects.

This is an example of JSON, in which we can see one array which holds two objects, each one of them holding three name/value pairs:

JSONdata

This week, we have also used a Twitter Archiving Google Sheet (TAGS), which is a mashup using the Twitter search API and Google’s API, created by Martin Hawksey. This is a tool to collect data and their related metadata from Twitter.

These are some results obtained from #citylis in Twitter:

Captura de pantalla 2014-11-19 a la(s) 15.48.09