16
Briefly, what is YAML?
What are the advantages of using it?
What are the disadvantages in its use compared to XML and/or JSON?
16
Briefly, what is YAML?
What are the advantages of using it?
What are the disadvantages in its use compared to XML and/or JSON?
16
YAML (recursive acronym for YAML Ain’t Markup Language) is a human-readable data encoding format.
The YAML was done essentially to store data (as well as databases).
Regarding XML and JSON readability is much easier and you write more easily. In addition, it is very well documented and has several libraries.
I did not confirm, but it seems that JSON can be partially interpreted by a parser yaml.
YAML
blog:
nome: Café = linhas
url: http://exemplo.com
post:
titulo: hello world
data: 12/04/2011
JSON
{
"blog": {
"nome": "Café = linhas",
"url": "http://exemplo.com",
"post": {
"titulo": "hello world",
"data": "12/04/2011"
}
}
}
XML
<?xml version="1.0" encoding="UTF-8" ?>
<blog>
<nome>Café = linhas</nome>
<url>http://exemplo.com</url>
<post>
<titulo>hello world</titulo>
<data>12/04/2011</data>
</post>
</blog>
Due to this need for spaces YAML can quickly take up more space than JSON and XML.
Although, in the present day space is no longer a big problem, but if your project needs the data to be small, YAML may not be for you.
To performance JSON is faster to interpret the data. (Source: https://stackoverflow.com/questions/2451732/how-is-it-that-json-serialization-is-so-much-faster-than-yaml-serialization-in-p)
Statements, many languages support XML and JSON by default, but not YAML.
Whether your file can be edited manually by a user (as was the case with the Bukkit project). YAML may be a good choice, but I see no advantage to any other cases.
It can take up more space and is less performative, plus you probably need to use third-party libraries to make it work.
If I were to use YAML to store data I would prefer to use a database as Mysql or Sqlite. If I were to send data to an API I would choose JSON or XML, preferably JSON for taking up less space, and consequently, user internet data.
7
Recursive acronym for YAML Ain’t Markup Language
.
It is a human-readable data serialization format, which was inspired by concepts of languages such as XML
, C
, Python
, Perl
and also the electronic mail format specified in RFC 2822
. It was proposed by Clark Evans in 2001 and designed in conjunction with Ingy döt Net and Oren Benkiki.
Although it is no less generic than the XML
, the YAML
is largely simpler to read, edit, modificar and produce than the XML
. That is, almost everything that is possible to represent in XML
can be represented in YAML
, and at the same time, in a more compact way. The YAML
was definido to support only characters in UTF8 or UTF16 system, parsers' behavior being undefined when stream YAML
is in any other encoding.
Perks
What are the disadvantages in its use compared to XML and/or JSON?
Advantage is that it is easier to read, disadvantage that is more complex to generate and analyze.
Reference:
Browser other questions tagged yaml
You are not signed in. Login or sign up in order to post.
O YAML precisa ser identado com espaços, se você usar TAB um erro ocorrerá, isso pode ser bem irritante as vezes.
- That’s no disadvantage, it’s an advantage for consistency.– Andre Figueiredo
Devido a essa necessidade de espaços o YAML pode rapidamente ocupar mais espaço que o JSON e o XML.
- this statement is not completely wrong because you used "can"! JSON has quotes for key/value, brackets, keys. I’m not even going to talk about XML because it’s extremely verbose: YAML is just to be a dry XML for data. Even in machine code, remember that YAML can also be minified, taking advantage of the fact that it contains JSON as a partial subset.– Andre Figueiredo