Why is JSON not considered a markup language? And why is XML?

4

I was researching the differences between JSON and XML so I read that XML is a markup language but I did not read anything about JSON.

    
asked by anonymous 01.06.2017 / 23:14

2 answers

4

Not always this kind of categorization is so rigid, but in my opinion it would force the bar to want to define JSON as a markup language.

I can not imagine getting an arbitrary document and "tagging" it using JSON. It's even possible in theory. After all, both XML and HTML were created to be interpreted as a tree, and JSON organizes things in a tree. But notice that it is already a degree of abstraction above. An XML-tagged document is relatively readable by humans before being transformed into a tree. HTML is more readable yet. JSON is not as readable.

Let's take a very simple HTML example as an example:

texto <strong>texto destacado</strong> texto

The simplest way I can imagine this in JSON would be:

{
  txt: 'texto ',
  strong: 'texto destacado',
  txt: ' texto'
}

This is relatively readable, but clearly less than the original. HTML would be much closer to the original. Other than that, in JSON there is no guarantee as to the order of the keys of an object. So, the above representation is not reliable. It would take something even more complex, like:

[
  { type: 'text', value: 'texto ' },
  { type: 'strong', value: 'texto destacado' },
  { type: 'text', value: ' texto' }
]

My conclusion: It would even be possible to formally consider JSON as a markup language. JSON was created with a somewhat different purpose (with a more focused exchange between systems than readability, although it is relatively readable), and therefore not the simplest solution for use cases of markup languages - whose example most known is HTML itself.

    
01.06.2017 / 23:46
1

Translated from : link

From Wikipedia :

  

A markup language (document) is a modern system for annotating a document so that it is synthetically distinguishable from the text. The idea and terminology evolved from the "marking" of paper manuscripts, that is, the revision instructions by editors, traditionally written with a blue pencil in manuscripts of authors.   Then no. JSON is not a markup language.

For this, neither XML. Wikipedia describes this as "a meta-markup language" as it provides a basis for creating markup languages.

JSON is like XML because it is used to structure data in a text format and is commonly used to exchange data over the Internet.

    
01.06.2017 / 23:18