XML alternatives

Some bad thing about XML is that it can happen that 99% of a XML file content is used just for the XML tags and the rest for the data to be stored. Therefore some other formats are commonly used:

JSON

Json stands for Java Script Object Notation. It is a way to format data using Javascript syntax. This is why it can be easily be imported into Javascript using the Javascript's eval() function. To not get a syntax error brackets need to be used:

var j = eval ("(" + <string variable containing json> + ")");

However since a files could contain also code instead of just data, json files are usually be parsed and not executed.

json is used by firefox to hold the bookmark backups ~/.mozilla/firefox/<some random characters>.default/bookmarkbackups

Python supports json https://docs.python.org/3/library/json.html. The concept is that a json data represented in a string can be converted in a python structure and back.

Python has also json functionality in its standard library.

To validate json the text can be copied and pasted into https://jsonlint.com

Json assigns a value to a name:

"<name>" : "<value>"

Multiple name/value pairs can be grouped

{ "<name1>":"<value1>" , "<name2>":"<value2>" } 

or put into an array

{
"<array name>": [
{ "<name1>":"<value1>" },
{ "<name2>":"<value2>" }
]
}

Linurs startpage