Talk:YAML

From Wikipedia, the free encyclopedia

Wiki Education Foundation-supported course assignment

This article is or was the subject of a Wiki Education Foundation-supported course assignment. Further details are available on the course page. Student editor(s): Vchitto, Dbzvishal.

Above undated message substituted from Template:Dashboard.wikiedu.org assignment by PrimeBOT (talk) 05:13, 18 January 2022 (UTC)

Nice page

Thanks to everyone that assembled this great summary of YAML. You guy's rock! Seriously, this is page looks perfect to me. As a casual Wikipedia browser, my only suggestion would be to remove the dust-brush from the design section. It may be technically correct, but dude! It's such a short section why nit pick? The big banner seems like an easy way to seem like you care about the content without really doing anything and at the same time makes the page look trashy.  Preceding unsigned comment added by 58.174.104.151 (talk) 14:33, 7 November 2019 (UTC)

I created the page 'data-oriented design' r.e. the videgame programming methodology. A link to it appeared here, however I'd guess they really wanted dat-driven design or something. Any suggestions on a fix... should 'data oriented design' be a disambiguation page, and we rename the current page content 'data-oriented design (video games)'? Fmadd (talk) 11:12, 9 September 2016 (UTC)

JSON as a subset of YAML

this section of the comments appears to be moot since the release of yaml 1.2 which makes JSON a subset. it's now cited as well.


I agree that comment blocks are irrelevant to whether JSON is a subset of YAML -- the anon was correct to remove that text. However, I still think "almost a subset" is correct; I've heard that there are subtle differences in edge cases in the way they quote strings as dictionary keys.

Does anyone know how we can verify facts like this, given that they tend to only appear on tech blogs and mailing lists? rspeer / ɹəədsɹ 16:04, 5 October 2007 (UTC)

First, try google books or google scholar and see if they have an easy link to anyone has thoroughly researched this question. If yes, cite it. If no, go to the next step.
Second, to yaml.org and the sourceforge site that hosts all the discussion threads on the design of YAML. You can also search for the proper name of obvious candidates for expertise on the subject, such as Douglas Crockford.
Trawl around for the most specific posts on this matter and see if they cite anything authoritative (such as the ECMASCRIPT or YAML spec). If yes, then cite what they cite, if not, cite the forum post itself and just be ready to fight the uphill battle if anyone contests the validity of the cite itself, using the standard "you can't cite forums on Wikipedia" line (despite the fact that forums actually tend to be the most authoritative sources for some of the more arcane matters in open source software development). dr.ef.tymac 17:19, 5 October 2007 (UTC)

YAML really is not a superset of JSON. Consider the following Perl script:

#!/usr/bin/perl
use Data::Dumper;
use JSON;
use YAML::Loader;
use YAML::Tiny;

$Data::Dumper::Sortkeys = 1;

my $input = "{ \"Foo\": 1 }\n";

print "JSON -----------\n";
eval { print Dumper(JSON->new->decode($input)); }
	or warn $@;

print "YAML::Loader ---\n";
eval { print Dumper(YAML::Loader->new->load($input)); }
	or warn $@;

print "YAML::Tiny -----\n";
eval { print Dumper(YAML::Tiny->new->read_string($input)); }
	or warn $@;

It produces the following output:

JSON -----------
$VAR1 = {
          'Foo' => 1
        };
YAML::Loader ---
YAML Error: Invalid element in map
   Code: YAML_LOAD_ERR_BAD_MAP_ELEMENT
   Line: 1
   Document: 1
 at /usr/lib/perl5/site_perl/5.10.1/YAML/Loader.pm line 352
YAML::Tiny -----
$VAR1 = bless( [
                 {
                   '{ "Foo"' => '1 }'
                 }
               ], 'YAML::Tiny' );

One YAML implementation (YAML::Loader - which was written by Ingy dot Net) crashes on a simple JSON input. The other does not crash, but produces output very different from expected. 217.169.28.122 (talk) 19:07, 3 October 2011 (UTC)


Citing YAML™ 1.2, 3rd Ed., 2009 — Specifications, paragraph two, under the 1st section (Status of this Document), reads:
Not sure how/what/if anything you wanted to add to the article in that regard so I'll leave it with you at that. Who R you? Talk 04:30, 24 October 2011 (UTC)

JSON is still not a subset of YAML 1.2?

The POD doc for JSON::XS states:

You often hear that JSON is a subset of YAML. This is, however, a mass hysteria(*) and very far from the truth (as of the time of this writing), so let me state it clearly: in general, there is no way to configure JSON::XS to output a data structure as valid YAML that works in all cases.

And later on:

I have been pressured multiple times by Brian Ingerson (one of the authors of the YAML specification) to remove this paragraph, despite her acknowledging that the actual incompatibilities exist. As I was personally bitten by this "JSON is YAML" lie, I refused and said I will continue to educate people about these issues, so others do not run into the same problem again and again. After this, Brian called me a (quote)complete and worthless idiot(unquote).
In my opinion, instead of pressuring and insulting people who actually clarify issues with YAML and the wrong statements of some of its proponents, I would kindly suggest reading the JSON spec (which is not that difficult or long) and finally make YAML compatible to it, and educating users about the changes, instead of spreading lies about the real compatibility for many years and trying to silence people who point out that it isn't true.
Addendum/2009: the YAML 1.2 spec is still incompatible with JSON, even though the incompatibilities have been documented (and are known to Brian) for many years and the spec makes explicit claims that YAML is a superset of JSON. It would be so easy to fix, but apparently, bullying people and corrupting userdata is so much easier.

This article currently states that "JSON syntax is a subset of YAML version 1.2," which may not be strictly true. Any opinions? — SamHathaway (talk) 20:28, 16 January 2013 (UTC)

JSON is a subset of YAML 1.2. Every valid JSON document is also a valid YAML 1.2 document. That said:

  • It is a proper superset. Not all YAML documents can be represented as JSON.
  • Even if a YAML document could be represented as JSON, YAML implementations are not required to emit JSON. Some implementations may support this via configuration.
  • Some YAML implementations may have bugs that prevent them from loading some JSON documents, even though those are valid YAML documents. I am not familiar with the Perl implementation in particular, but I am aware that a lot of work has been done in recent years to improve spec compliance of popular YAML implementations.
  • There is a misunderstood corner case involving unpaired surrogates. Valid JSON must be encoded in UTF-8, 16, or 32. These encodings do not allow unpaired surrogates; therefore, a document with unpaired surrogates is not valid JSON. YAML streams also may not contain unpaired surrogates.

There are a lot of pages out there claiming that JSON is not a subset of YAML 1.2. Some of them even have examples. But the examples are invariably either invalid JSON (e.g. the surrogate thing) or valid YAML that a particular implementation is choking on. In the unlikely event that there is some valid JSON document that is not also valid YAML, it should be reported at https://github.com/yaml/yaml-spec so that errata can be issued. — Thom1729 (talk) 16:20, 7 February 2022 (UTC)

From a practical pov, the inability to accept unpaired surrogates is an incompatibility with JSON, or at least with the vast majority of JSON implementations that do accept them. As Windows filenames can contain unpaired surrogates this is a problem since you can no longer put Windows filenames into the "string" datatype.Spitzak (talk) 20:06, 7 February 2022 (UTC)
JSON explicitly allows the utilization of tabs as whitespace, which is not allowed in YAML. Any valid JSON file using tab indentation is thus not a valid YAML document. 178.27.112.87 (talk) 12:50, 27 October 2022 (UTC)
In "JSON-style data" (ie surrounded by delimiters like {} and []) YAML treats all whitespace, including tabs, identically. It does not matter how it treats whitespace for non-JSON-style data where the indentation is part of the syntax, that part does not intersect the JSON-compatable part.Spitzak (talk) 20:51, 27 October 2022 (UTC)
I guess I have to file a bug to pyyaml… 178.27.112.87 (talk) 19:49, 28 October 2022 (UTC)

Section on node order in hashes

YAML application

King of Hearts

Relational Trees

Ingy döt Net

Capitalization: libYAML vs. LibYAML

Repeated nodes with modifications

Section On Features Does Not Have Neutral Point Of View

Is the syntax sub-heading necessary?

Syntax section revert

Too much repetition

Does YAML have "decorations", or should that be "declarations"?

Removing last bullet point of "Criticism" section

Two of the "Criticism" section bullet points are criticism of a specific implementation of a particular YAML parser rather than criticism of the language; I suggest deleting them

Is YAML really a "language"?

Related Articles

Wikiwand AI