- name: Mark McGwire hr: 65 avg: 0.278 - name: Sammy Sosa hr: 63 avg: 0.288
+STR +DOC +SEQ +MAP =VAL :name =VAL :Mark McGwire =VAL :hr =VAL :65 =VAL :avg =VAL :0.278 -MAP +MAP =VAL :name =VAL :Sammy Sosa =VAL :hr =VAL :63 =VAL :avg =VAL :0.288 -MAP -SEQ -DOC -STR
[
{
"name": "Mark McGwire",
"hr": 65,
"avg": 0.278
},
{
"name": "Sammy Sosa",
"hr": 63,
"avg": 0.288
}
]
[
{
"name": "Mark McGwire",
"hr": 65,
"avg": 0.278
},
{
"name": "Sammy Sosa",
"hr": 63,
"avg": 0.288
}
]
foo: bar invalid
Yamlrw error: expected mapping key at line 3, columns 1-1
"top1" : "key1" : &alias1 scalar1 'top2' : 'key2' : &alias2 scalar2 top3: &node3 *alias1 : scalar3 top4: *alias2 : scalar4 top5 : scalar5 top6: &anchor6 'key6' : scalar6
+STR +DOC +MAP =VAL "top1 +MAP =VAL "key1 =VAL &alias1 :scalar1 -MAP =VAL 'top2 +MAP =VAL 'key2 =VAL &alias2 :scalar2 -MAP =VAL :top3 +MAP &node3 =ALI *alias1 =VAL :scalar3 -MAP =VAL :top4 +MAP =ALI *alias2 =VAL :scalar4 -MAP =VAL :top5 =VAL :scalar5 =VAL :top6 +MAP =VAL &anchor6 'key6 =VAL :scalar6 -MAP -MAP -DOC -STR
{
"top1": {
"key1": "scalar1"
},
"top2": {
"key2": "scalar2"
},
"top3": {
"scalar1": "scalar3"
},
"top4": {
"scalar2": "scalar4"
},
"top5": "scalar5",
"top6": {
"key6": "scalar6"
}
}
{
"top1": {
"key1": "scalar1"
},
"top2": {
"key2": "scalar2"
},
"top3": {
"scalar1": "scalar3"
},
"top4": {
"scalar2": "scalar4"
},
"top5": "scalar5",
"top6": {
"key6": "scalar6"
}
}
%YAML 1.2 --- text
+STR +DOC --- =VAL :text -DOC -STR
"text"
"text"
- !!str a - b - !!int 42 - d
+STR +DOC +SEQ =VAL <tag:yaml.org,2002:str> :a =VAL :b =VAL <tag:yaml.org,2002:int> :42 =VAL :d -SEQ -DOC -STR
[ "a", "b", 42, "d" ]
[ "a", "b", 42, "d" ]
this is invalid: x
Yamlrw error: expected mapping key at line 3, columns 10-10
a!"#$%&'()*+,-./09:;<=>?@AZ[\]^_`az{|}~: safe
?foo: safe question mark
:foo: safe colon
-foo: safe dash
this is#not: a comment
+STR
+DOC
+MAP
=VAL :a!"#$%&'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~
=VAL :safe
=VAL :?foo
=VAL :safe question mark
=VAL ::foo
=VAL :safe colon
=VAL :-foo
=VAL :safe dash
=VAL :this is#not
=VAL :a comment
-MAP
-DOC
-STR
{
"a!\"#$%&'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~": "safe",
"?foo": "safe question mark",
":foo": "safe colon",
"-foo": "safe dash",
"this is#not": "a comment"
}
{
"a!\"#$%&'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~": "safe",
"?foo": "safe question mark",
":foo": "safe colon",
"-foo": "safe dash",
"this is#not": "a comment"
}
--- |0
Yamlrw error: invalid block scalar header: expected newline after header at line 1, columns 6-6
--- |10
Yamlrw error: invalid block scalar header: expected newline after header at line 1, columns 7-7
--- |1-
+STR +DOC --- =VAL | -DOC -STR
""
""
--- |1+
+STR +DOC --- =VAL | -DOC -STR
""
""
: a : b
+STR +DOC +MAP =VAL : =VAL :a =VAL : =VAL :b -MAP -DOC -STR
%FOO bar baz # Should be ignored
# with a warning.
---
"foo"
+STR +DOC --- =VAL "foo -DOC -STR
"foo"
"foo"
&a: key: &a value foo: *a:
+STR +DOC +MAP =VAL &a: :key =VAL &a :value =VAL :foo =ALI *a: -MAP -DOC -STR
{
"key": "value",
"foo": "key"
}
{
"key": "value",
"foo": "key"
}
# Sets are represented as a # Mapping where each key is # associated with a null value --- !!set ? Mark McGwire ? Sammy Sosa ? Ken Griff
+STR +DOC --- +MAP <tag:yaml.org,2002:set> =VAL :Mark McGwire =VAL : =VAL :Sammy Sosa =VAL : =VAL :Ken Griff =VAL : -MAP -DOC -STR
{
"Mark McGwire": null,
"Sammy Sosa": null,
"Ken Griff": null
}
{
"Mark McGwire": null,
"Sammy Sosa": null,
"Ken Griff": null
}
--- - !!int 1 - !!int -2 - !!int 33
+STR +DOC --- +SEQ =VAL <tag:yaml.org,2002:int> :1 =VAL <tag:yaml.org,2002:int> :-2 =VAL <tag:yaml.org,2002:int> :33 -SEQ -DOC -STR
[ 1, -2, 33 ]
[ 1, -2, 33 ]
--- !!map ? a : b --- !!seq - !!str c --- !!str d e
+STR +DOC --- +MAP <tag:yaml.org,2002:map> =VAL :a =VAL :b -MAP -DOC +DOC --- +SEQ <tag:yaml.org,2002:seq> =VAL <tag:yaml.org,2002:str> :c -SEQ -DOC +DOC --- =VAL <tag:yaml.org,2002:str> :d e -DOC -STR
{
"a": "b"
}
[
"c"
]
"d e"
{
"a": "b"
}
[
"c"
]
"d e"
--- plain: a b c
+STR +DOC --- +MAP =VAL :plain =VAL :a b\nc -MAP -DOC -STR
{
"plain": "a b\nc"
}
{
"plain": "a b\nc"
}
- - s1_i1 - s1_i2 - s2
+STR +DOC +SEQ +SEQ =VAL :s1_i1 =VAL :s1_i2 -SEQ =VAL :s2 -SEQ -DOC -STR
[
[
"s1_i1",
"s1_i2"
],
"s2"
]
[
[
"s1_i1",
"s1_i2"
],
"s2"
]
First occurrence: &anchor Foo Second occurrence: *anchor Override anchor: &anchor Bar Reuse anchor: *anchor
+STR +DOC +MAP =VAL :First occurrence =VAL &anchor :Foo =VAL :Second occurrence =ALI *anchor =VAL :Override anchor =VAL &anchor :Bar =VAL :Reuse anchor =ALI *anchor -MAP -DOC -STR
{
"First occurrence": "Foo",
"Second occurrence": "Foo",
"Override anchor": "Bar",
"Reuse anchor": "Bar"
}
{
"First occurrence": "Foo",
"Second occurrence": "Foo",
"Override anchor": "Bar",
"Reuse anchor": "Bar"
}
--- key: value ... invalid
Yamlrw error: invalid directive: content not allowed after document end marker on same line at line 3, columns 1-1
--- k:#foo &a !t s
+STR +DOC --- =VAL :k:#foo &a !t s -DOC -STR
"k:#foo &a !t s"
"k:#foo &a !t s"
&sequence - a
+STR +DOC +SEQ &sequence =VAL :a -SEQ -DOC -STR
[ "a" ]
[ "a" ]
"1 leading
\ttab"
+STR +DOC =VAL "1 leading \ttab -DOC -STR
"1 leading \ttab"
"1 leading \ttab"
"2 leading
\ tab"
+STR +DOC =VAL "2 leading \ttab -DOC -STR
"2 leading \ttab"
"2 leading \ttab"
"3 leading
tab"
+STR +DOC =VAL "3 leading tab -DOC -STR
"3 leading tab"
"3 leading tab"
"4 leading
\t tab"
+STR +DOC =VAL "4 leading \t tab -DOC -STR
"4 leading \t tab"
"4 leading \t tab"
"5 leading
\ tab"
+STR +DOC =VAL "5 leading \t tab -DOC -STR
"5 leading \t tab"
"5 leading \t tab"
"6 leading
tab"
+STR +DOC =VAL "6 leading tab -DOC -STR
"6 leading tab"
"6 leading tab"
escaped slash: "a\/b"
+STR +DOC +MAP =VAL :escaped slash =VAL "a/b -MAP -DOC -STR
{
"escaped slash": "a/b"
}
{
"escaped slash": "a/b"
}
{
unquoted : "separate",
http://foo.com,
omitted value:,
}
+STR
+DOC
+MAP {}
=VAL :unquoted
=VAL "separate
=VAL :http://foo.com
=VAL :
=VAL :omitted value
=VAL :
-MAP
-DOC
-STR
plain: This unquoted scalar spans many lines. quoted: "So does this quoted scalar.\n"
+STR +DOC +MAP =VAL :plain =VAL :This unquoted scalar spans many lines. =VAL :quoted =VAL "So does this quoted scalar.\n -MAP -DOC -STR
{
"plain": "This unquoted scalar spans many lines.",
"quoted": "So does this quoted scalar.\n"
}
{
"plain": "This unquoted scalar spans many lines.",
"quoted": "So does this quoted scalar.\n"
}
--- a: b: c: value
Yamlrw error: tab character in indentation at line 3, columns 1-1
--- [ [ a, [ [[b,c]]: d, e]]: 23 ]
+STR
+DOC ---
+SEQ []
+MAP {}
+SEQ []
=VAL :a
+SEQ []
+MAP {}
+SEQ []
+SEQ []
=VAL :b
=VAL :c
-SEQ
-SEQ
=VAL :d
-MAP
=VAL :e
-SEQ
-SEQ
=VAL :23
-MAP
-SEQ
-DOC
-STR
'here''s to "quotes"'
+STR +DOC =VAL 'here's to "quotes" -DOC -STR
"here's to \"quotes\""
"here's to \"quotes\""
--- [ a, b, c ] ]
Yamlrw error: unexpected token: content not allowed after document value at line 2, columns 13-14
key: - ok - also ok - wrong
Yamlrw error: expected mapping key at line 4, columns 3-3
top1: &node1 &k1 key1: val1 top2: &node2 &v2 val2
Yamlrw error: duplicate anchor: &v2 at line 4, columns 3-6
{"foo"
: "bar"}
+STR
+DOC
+MAP {}
=VAL "foo
=VAL "bar
-MAP
-DOC
-STR
{
"foo": "bar"
}
{
"foo": "bar"
}
{"foo"
: bar}
+STR
+DOC
+MAP {}
=VAL "foo
=VAL :bar
-MAP
-DOC
-STR
{
"foo": "bar"
}
{
"foo": "bar"
}
{foo
: bar}
+STR
+DOC
+MAP {}
=VAL :foo
=VAL :bar
-MAP
-DOC
-STR
{
"foo": "bar"
}
{
"foo": "bar"
}
--- > ab cd ef gh
+STR +DOC --- =VAL >ab cd\nef\n\ngh\n -DOC -STR
"ab cd\nef\n\ngh\n"
"ab cd\nef\n\ngh\n"
- | detected - > # detected - |1 explicit - > detected
+STR +DOC +SEQ =VAL |detected\n =VAL >\n\n# detected\n =VAL | explicit\n =VAL >detected\n -SEQ -DOC -STR
[ "detected\n", "\n\n# detected\n", " explicit\n", "detected\n" ]
[ "detected\n", "\n\n# detected\n", " explicit\n", "detected\n" ]
[1, 2, 3]
+STR +DOC +SEQ [] =VAL :1 =VAL :2 =VAL :3 -SEQ -DOC -STR
[ 1, 2, 3 ]
[ 1, 2, 3 ]
"foo: bar\": baz"
+STR +DOC =VAL "foo: bar": baz -DOC -STR
"foo: bar\": baz"
"foo: bar\": baz"
--- plain\value\with\backslashes
+STR +DOC --- =VAL :plain\\value\\with\\backslashes -DOC -STR
"plain\\value\\with\\backslashes"
"plain\\value\\with\\backslashes"
- aaa: |2
xxx
bbb: |
xxx
+STR +DOC +SEQ +MAP =VAL :aaa =VAL |xxx\n =VAL :bbb =VAL |xxx\n -MAP -SEQ -DOC -STR
[
{
"aaa" : "xxx\n",
"bbb" : "xxx\n"
}
]
[
{
"aaa": "xxx\n",
"bbb": "xxx\n"
}
]
plain: text lines quoted: "text lines" block: | text lines
+STR +DOC +MAP =VAL :plain =VAL :text lines =VAL :quoted =VAL "text lines =VAL :block =VAL |text\n \tlines\n -MAP -DOC -STR
{
"plain": "text lines",
"quoted": "text lines",
"block": "text\n \tlines\n"
}
{
"plain": "text lines",
"quoted": "text lines",
"block": "text\n \tlines\n"
}
--- ! a
+STR +DOC --- =VAL <!> :a -DOC -STR
"a"
"a"
{foo: you, bar: far}
+STR
+DOC
+MAP {}
=VAL :foo
=VAL :you
=VAL :bar
=VAL :far
-MAP
-DOC
-STR
{
"foo": "you",
"bar": "far"
}
{
"foo": "you",
"bar": "far"
}
--- "\."
Yamlrw error: invalid escape sequence: \. at line 2, columns 3-3
canonical: !!binary "\ R0lGODlhDAAMAIQAAP//9/X17unp5WZmZgAAAOfn515eXvPz7Y6OjuDg4J+fn5\ OTk6enp56enmlpaWNjY6Ojo4SEhP/++f/++f/++f/++f/++f/++f/++f/++f/+\ +f/++f/++f/++f/++f/++SH+Dk1hZGUgd2l0aCBHSU1QACwAAAAADAAMAAAFLC\ AgjoEwnuNAFOhpEMTRiggcz4BNJHrv/zCFcLiwMWYNG84BwwEeECcgggoBADs=" generic: !!binary | R0lGODlhDAAMAIQAAP//9/X17unp5WZmZgAAAOfn515eXvPz7Y6OjuDg4J+fn5 OTk6enp56enmlpaWNjY6Ojo4SEhP/++f/++f/++f/++f/++f/++f/++f/++f/+ +f/++f/++f/++f/++f/++SH+Dk1hZGUgd2l0aCBHSU1QACwAAAAADAAMAAAFLC AgjoEwnuNAFOhpEMTRiggcz4BNJHrv/zCFcLiwMWYNG84BwwEeECcgggoBADs= description: The binary value above is a tiny arrow encoded as a gif image.
+STR +DOC +MAP =VAL :canonical =VAL <tag:yaml.org,2002:binary> "R0lGODlhDAAMAIQAAP//9/X17unp5WZmZgAAAOfn515eXvPz7Y6OjuDg4J+fn5OTk6enp56enmlpaWNjY6Ojo4SEhP/++f/++f/++f/++f/++f/++f/++f/++f/++f/++f/++f/++f/++f/++SH+Dk1hZGUgd2l0aCBHSU1QACwAAAAADAAMAAAFLCAgjoEwnuNAFOhpEMTRiggcz4BNJHrv/zCFcLiwMWYNG84BwwEeECcgggoBADs= =VAL :generic =VAL <tag:yaml.org,2002:binary> |R0lGODlhDAAMAIQAAP//9/X17unp5WZmZgAAAOfn515eXvPz7Y6OjuDg4J+fn5\nOTk6enp56enmlpaWNjY6Ojo4SEhP/++f/++f/++f/++f/++f/++f/++f/++f/+\n+f/++f/++f/++f/++f/++SH+Dk1hZGUgd2l0aCBHSU1QACwAAAAADAAMAAAFLC\nAgjoEwnuNAFOhpEMTRiggcz4BNJHrv/zCFcLiwMWYNG84BwwEeECcgggoBADs=\n =VAL :description =VAL :The binary value above is a tiny arrow encoded as a gif image. -MAP -DOC -STR
{
"canonical": "R0lGODlhDAAMAIQAAP//9/X17unp5WZmZgAAAOfn515eXvPz7Y6OjuDg4J+fn5OTk6enp56enmlpaWNjY6Ojo4SEhP/++f/++f/++f/++f/++f/++f/++f/++f/++f/++f/++f/++f/++f/++SH+Dk1hZGUgd2l0aCBHSU1QACwAAAAADAAMAAAFLCAgjoEwnuNAFOhpEMTRiggcz4BNJHrv/zCFcLiwMWYNG84BwwEeECcgggoBADs=",
"generic": "R0lGODlhDAAMAIQAAP//9/X17unp5WZmZgAAAOfn515eXvPz7Y6OjuDg4J+fn5\nOTk6enp56enmlpaWNjY6Ojo4SEhP/++f/++f/++f/++f/++f/++f/++f/++f/+\n+f/++f/++f/++f/++f/++SH+Dk1hZGUgd2l0aCBHSU1QACwAAAAADAAMAAAFLC\nAgjoEwnuNAFOhpEMTRiggcz4BNJHrv/zCFcLiwMWYNG84BwwEeECcgggoBADs=\n",
"description": "The binary value above is a tiny arrow encoded as a gif image."
}
{
"canonical": "R0lGODlhDAAMAIQAAP//9/X17unp5WZmZgAAAOfn515eXvPz7Y6OjuDg4J+fn5OTk6enp56enmlpaWNjY6Ojo4SEhP/++f/++f/++f/++f/++f/++f/++f/++f/++f/++f/++f/++f/++f/++SH+Dk1hZGUgd2l0aCBHSU1QACwAAAAADAAMAAAFLCAgjoEwnuNAFOhpEMTRiggcz4BNJHrv/zCFcLiwMWYNG84BwwEeECcgggoBADs=",
"generic": "R0lGODlhDAAMAIQAAP//9/X17unp5WZmZgAAAOfn515eXvPz7Y6OjuDg4J+fn5\nOTk6enp56enmlpaWNjY6Ojo4SEhP/++f/++f/++f/++f/++f/++f/++f/++f/+\n+f/++f/++f/++f/++f/++SH+Dk1hZGUgd2l0aCBHSU1QACwAAAAADAAMAAAFLC\nAgjoEwnuNAFOhpEMTRiggcz4BNJHrv/zCFcLiwMWYNG84BwwEeECcgggoBADs=\n",
"description": "The binary value above is a tiny arrow encoded as a gif image."
}
sequence: !!seq - entry - !!seq - nested mapping: !!map foo: bar
+STR +DOC +MAP =VAL :sequence +SEQ <tag:yaml.org,2002:seq> =VAL :entry +SEQ <tag:yaml.org,2002:seq> =VAL :nested -SEQ -SEQ =VAL :mapping +MAP <tag:yaml.org,2002:map> =VAL :foo =VAL :bar -MAP -MAP -DOC -STR
{
"sequence": [
"entry",
[
"nested"
]
],
"mapping": {
"foo": "bar"
}
}
{
"sequence": [
"entry",
[
"nested"
]
],
"mapping": {
"foo": "bar"
}
}
{x: :x}
+STR
+DOC
+MAP {}
=VAL :x
=VAL ::x
-MAP
-DOC
-STR
{
"x": ":x"
}
{
"x": ":x"
}
literal: | some text folded: > some text
+STR +DOC +MAP =VAL :literal =VAL |some\ntext\n =VAL :folded =VAL >some text\n -MAP -DOC -STR
{
"literal": "some\ntext\n",
"folded": "some text\n"
}
{
"literal": "some\ntext\n",
"folded": "some text\n"
}
- { one : two , three: four , }
- {five: six,seven : eight}
+STR
+DOC
+SEQ
+MAP {}
=VAL :one
=VAL :two
=VAL :three
=VAL :four
-MAP
+MAP {}
=VAL :five
=VAL :six
=VAL :seven
=VAL :eight
-MAP
-SEQ
-DOC
-STR
[
{
"one": "two",
"three": "four"
},
{
"five": "six",
"seven": "eight"
}
]
[
{
"one": "two",
"three": "four"
},
{
"five": "six",
"seven": "eight"
}
]
Folding: "Empty line as a line feed" Chomping: | Clipped empty lines
+STR +DOC +MAP =VAL :Folding =VAL "Empty line\nas a line feed =VAL :Chomping =VAL |Clipped empty lines\n -MAP -DOC -STR
{
"Folding": "Empty line\nas a line feed",
"Chomping": "Clipped empty lines\n"
}
{
"Folding": "Empty line\nas a line feed",
"Chomping": "Clipped empty lines\n"
}
- [ one, two, ] - [three ,four]
+STR +DOC +SEQ +SEQ [] =VAL :one =VAL :two -SEQ +SEQ [] =VAL :three =VAL :four -SEQ -SEQ -DOC -STR
[
[
"one",
"two"
],
[
"three",
"four"
]
]
[
[
"one",
"two"
],
[
"three",
"four"
]
]
block scalar: > invalid
Yamlrw error: invalid block scalar header: wrongly indented line in block scalar at line 5, columns 2-2
---
{ "foo"
:bar }
+STR
+DOC ---
+MAP {}
=VAL "foo
=VAL :bar
-MAP
-DOC
-STR
{
"foo": "bar"
}
{
"foo": "bar"
}
key: # Comment value
+STR +DOC +MAP =VAL :key =VAL :value -MAP -DOC -STR
{
"key": "value"
}
{
"key": "value"
}
- { "key":value }
- { "key"::value }
+STR
+DOC
+SEQ
+MAP {}
=VAL "key
=VAL :value
-MAP
+MAP {}
=VAL "key
=VAL ::value
-MAP
-SEQ
-DOC
-STR
[
{
"key": "value"
},
{
"key": ":value"
}
]
[
{
"key": "value"
},
{
"key": ":value"
}
]
--- " --- "
Yamlrw error: unclosed double quote at line 2, columns 1-1
%TAG !m! !my- --- # Bulb here !m!light fluorescent ... %TAG !m! !my- --- # Color here !m!light green
+STR +DOC --- =VAL <!my-light> :fluorescent -DOC ... +DOC --- =VAL <!my-light> :green -DOC -STR
"fluorescent" "green"
"fluorescent" "green"
key: - a
- b
Yamlrw error: block sequence entries are not allowed in this context at line 1, columns 6-6
? explicit key # Empty value ? | block key : - one # Explicit compact - two # block value
+STR +DOC +MAP =VAL :explicit key =VAL : =VAL |block key\n +SEQ =VAL :one =VAL :two -SEQ -MAP -DOC -STR
{
"explicit key": null,
"block key\n": [
"one",
"two"
]
}
{
"explicit key": null,
"block key\n": [
"one",
"two"
]
}
---
x: { y: z }in: valid
Yamlrw error: expected mapping key at line 2, columns 12-14
{ ?foo: bar,
bar: 42
}
+STR
+DOC
+MAP {}
=VAL :?foo
=VAL :bar
=VAL :bar
=VAL :42
-MAP
-DOC
-STR
{
"?foo" : "bar",
"bar" : 42
}
{
"?foo": "bar",
"bar": 42
}
- foo
+STR +DOC +SEQ =VAL :foo -SEQ -DOC -STR
[ "foo" ]
[ "foo" ]
- foo: bar - - baz - baz
+STR +DOC +SEQ +MAP =VAL :foo =VAL :bar -MAP +SEQ =VAL :baz =VAL :baz -SEQ -SEQ -DOC -STR
[
{
"foo": "bar"
},
[
"baz",
"baz"
]
]
[
{
"foo": "bar"
},
[
"baz",
"baz"
]
]
--- &mapping &key [ &item a, b, c ]: value
+STR +DOC --- +MAP &mapping +SEQ [] &key =VAL &item :a =VAL :b =VAL :c -SEQ =VAL :value -MAP -DOC -STR
[ ]
+STR +DOC +SEQ [] -SEQ -DOC -STR
[]
[]
%TAG !e! tag:example.com,2000:app/ --- - !local foo - !!str bar - !e!tag%21 baz
+STR +DOC --- +SEQ =VAL <!local> :foo =VAL <tag:yaml.org,2002:str> :bar =VAL <tag:example.com,2000:app/tag!> :baz -SEQ -DOC -STR
[ "foo", "bar", "baz" ]
[ "foo", "bar", "baz" ]
--- |+ ab ...
+STR +DOC --- =VAL |ab\n\n \n -DOC ... -STR
"ab\n\n \n"
"ab\n\n \n"
'foo: bar\': baz'
+STR +DOC +MAP =VAL 'foo: bar\\ =VAL :baz' -MAP -DOC -STR
{
"foo: bar\\": "baz'"
}
{
"foo: bar\\": "baz'"
}
# Leading comment line spaces are
# neither content nor indentation.
Not indented:
By one space: |
By four
spaces
Flow style: [ # Leading spaces
By two, # in flow style
Also by two, # are neither
Still by two # content nor
] # indentation.
+STR +DOC +MAP =VAL :Not indented +MAP =VAL :By one space =VAL |By four\n spaces\n =VAL :Flow style +SEQ [] =VAL :By two =VAL :Also by two =VAL :Still by two -SEQ -MAP -MAP -DOC -STR
{
"Not indented": {
"By one space": "By four\n spaces\n",
"Flow style": [
"By two",
"Also by two",
"Still by two"
]
}
}
{
"Not indented": {
"By one space": "By four\n spaces\n",
"Flow style": [
"By two",
"Also by two",
"Still by two"
]
}
}
# ASCII Art --- | \//||\/|| // || ||__
+STR +DOC --- =VAL |\\//||\\/||\n// || ||__\n -DOC -STR
"\\//||\\/||\n// || ||__\n"
"\\//||\\/||\n// || ||__\n"
--- [ [ a, b, c ]
Yamlrw error: expected sequence end ']' at line 3, columns 1-1
foo: !!seq
- !!str a
- !!map
key: !!str value
+STR +DOC +MAP =VAL :foo +SEQ <tag:yaml.org,2002:seq> =VAL <tag:yaml.org,2002:str> :a +MAP <tag:yaml.org,2002:map> =VAL :key =VAL <tag:yaml.org,2002:str> :value -MAP -SEQ -MAP -DOC -STR
{
"foo": [
"a",
{
"key": "value"
}
]
}
{
"foo": [
"a",
{
"key": "value"
}
]
}
--- a: &anchor b: *anchor
+STR +DOC --- +MAP =VAL :a =VAL &anchor : =VAL :b =ALI *anchor -MAP -DOC -STR
{
"a": null,
"b": null
}
{
"a": null,
"b": null
}
%FOO bar baz # Should be ignored
# with a warning.
--- "foo"
+STR +DOC --- =VAL "foo -DOC -STR
"foo"
"foo"
? &a a : &b b : *a
+STR +DOC +MAP =VAL &a :a =VAL &b :b =VAL : =ALI *a -MAP -DOC -STR
--- ? - a - b : - c - d
+STR +DOC --- +MAP +SEQ =VAL :a =VAL :b -SEQ +SEQ =VAL :c =VAL :d -SEQ -MAP -DOC -STR
key: - bar - baz invalid
Yamlrw error: expected mapping key at line 4, columns 2-2
"foo\nbar:baz\tx \\$%^&*()x": 23 'x\ny:z\tx $%^&*()x': 24
+STR +DOC +MAP =VAL "foo\nbar:baz\tx \\$%^&*()x =VAL :23 =VAL 'x\\ny:z\\tx $%^&*()x =VAL :24 -MAP -DOC -STR
{
"foo\nbar:baz\tx \\$%^&*()x": 23,
"x\\ny:z\\tx $%^&*()x": 24
}
{
"foo\nbar:baz\tx \\$%^&*()x": 23,
"x\\ny:z\\tx $%^&*()x": 24
}
> Sammy Sosa completed another fine season with great stats. 63 Home Runs 0.288 Batting Average What a year!
+STR +DOC =VAL >Sammy Sosa completed another fine season with great stats.\n\n 63 Home Runs\n 0.288 Batting Average\n\nWhat a year!\n -DOC -STR
"Sammy Sosa completed another fine season with great stats.\n\n 63 Home Runs\n 0.288 Batting Average\n\nWhat a year!\n"
"Sammy Sosa completed another fine season with great stats.\n\n 63 Home Runs\n 0.288 Batting Average\n\nWhat a year!\n"
# Private --- !foo "bar" ... # Global %TAG ! tag:example.com,2000:app/ --- !foo "bar"
+STR +DOC --- =VAL <!foo> "bar -DOC ... +DOC --- =VAL <tag:example.com,2000:app/foo> "bar -DOC -STR
"bar" "bar"
"bar" "bar"
---
"
foo
bar
baz
"
+STR +DOC --- =VAL " foo\nbar\nbaz -DOC -STR
" foo\nbar\nbaz "
" foo\nbar\nbaz "
--- ---
+STR +DOC --- =VAL : -DOC +DOC --- =VAL : -DOC -STR
null null
null null
Document --- # Empty ... %YAML 1.2 --- matches %: 20
+STR +DOC =VAL :Document -DOC +DOC --- =VAL : -DOC ... +DOC --- +MAP =VAL :matches % =VAL :20 -MAP -DOC -STR
"Document"
null
{
"matches %": 20
}
"Document"
null
{
"matches %": 20
}
- "flow in block" - > Block scalar - !!map # Block collection foo : bar
+STR +DOC +SEQ =VAL "flow in block =VAL >Block scalar\n +MAP <tag:yaml.org,2002:map> =VAL :foo =VAL :bar -MAP -SEQ -DOC -STR
[
"flow in block",
"Block scalar\n",
{
"foo": "bar"
}
]
[
"flow in block",
"Block scalar\n",
{
"foo": "bar"
}
]
!!str a: b c: !!int 42 e: !!str f g: h !!str 23: !!bool false
+STR +DOC +MAP =VAL <tag:yaml.org,2002:str> :a =VAL :b =VAL :c =VAL <tag:yaml.org,2002:int> :42 =VAL :e =VAL <tag:yaml.org,2002:str> :f =VAL :g =VAL :h =VAL <tag:yaml.org,2002:str> :23 =VAL <tag:yaml.org,2002:bool> :false -MAP -DOC -STR
{
"a": "b",
"c": 42,
"e": "f",
"g": "h",
"23": false
}
{
"a": "b",
"c": 42,
"e": "f",
"g": "h",
"23": false
}
--- |- ab ...
+STR +DOC --- =VAL |ab -DOC ... -STR
"ab"
"ab"
" 1st non-empty 2nd non-empty 3rd non-empty "
+STR +DOC =VAL " 1st non-empty\n2nd non-empty 3rd non-empty -DOC -STR
" 1st non-empty\n2nd non-empty 3rd non-empty "
" 1st non-empty\n2nd non-empty 3rd non-empty "
--- top1: &node1 &k1 key1: one top2: &node2 # comment key2: two top3: &k3 key3: three top4: &node4 &k4 key4: four top5: &node5 key5: five top6: &val6 six top7: &val7 seven
+STR +DOC --- +MAP =VAL :top1 +MAP &node1 =VAL &k1 :key1 =VAL :one -MAP =VAL :top2 +MAP &node2 =VAL :key2 =VAL :two -MAP =VAL :top3 +MAP =VAL &k3 :key3 =VAL :three -MAP =VAL :top4 +MAP &node4 =VAL &k4 :key4 =VAL :four -MAP =VAL :top5 +MAP &node5 =VAL :key5 =VAL :five -MAP =VAL :top6 =VAL &val6 :six =VAL :top7 =VAL &val7 :seven -MAP -DOC -STR
{
"top1": {
"key1": "one"
},
"top2": {
"key2": "two"
},
"top3": {
"key3": "three"
},
"top4": {
"key4": "four"
},
"top5": {
"key5": "five"
},
"top6": "six",
"top7": "seven"
}
{
"top1": {
"key1": "one"
},
"top2": {
"key2": "two"
},
"top3": {
"key3": "three"
},
"top4": {
"key4": "four"
},
"top5": {
"key5": "five"
},
"top6": "six",
"top7": "seven"
}
--- hr: - Mark McGwire # Following node labeled SS - &SS Sammy Sosa rbi: - *SS # Subsequent occurrence - Ken Griffey
+STR +DOC --- +MAP =VAL :hr +SEQ =VAL :Mark McGwire =VAL &SS :Sammy Sosa -SEQ =VAL :rbi +SEQ =ALI *SS =VAL :Ken Griffey -SEQ -MAP -DOC -STR
{
"hr": [
"Mark McGwire",
"Sammy Sosa"
],
"rbi": [
"Sammy Sosa",
"Ken Griffey"
]
}
{
"hr": [
"Mark McGwire",
"Sammy Sosa"
],
"rbi": [
"Sammy Sosa",
"Ken Griffey"
]
}
!<tag:yaml.org,2002:str> foo : !<!bar> baz
+STR +DOC +MAP =VAL <tag:yaml.org,2002:str> :foo =VAL <!bar> :baz -MAP -DOC -STR
{
"foo": "baz"
}
{
"foo": "baz"
}
"a\nb": 1 "c d": 1
Yamlrw error: expected mapping key at line 2, columns 1-1
top1: key1: val1 top2
Yamlrw error: expected mapping key at line 3, columns 1-1
> folded line next line * bullet * list * lines last line # Comment
+STR +DOC =VAL >\nfolded line\nnext line\n * bullet\n\n * list\n * lines\n\nlast line\n -DOC -STR
"\nfolded line\nnext line\n * bullet\n\n * list\n * lines\n\nlast line\n"
"\nfolded line\nnext line\n * bullet\n\n * list\n * lines\n\nlast line\n"
--- [ word1 # comment , word2]
+STR +DOC --- +SEQ [] =VAL :word1 =VAL :word2 -SEQ -DOC -STR
[ "word1", "word2" ]
[ "word1", "word2" ]
? a ? b c:
+STR +DOC +MAP =VAL :a =VAL : =VAL :b =VAL : =VAL :c =VAL : -MAP -DOC -STR
{
"a": null,
"b": null,
"c": null
}
{
"a": null,
"b": null,
"c": null
}
--- scalar1 ... key: value
+STR +DOC --- =VAL :scalar1 -DOC ... +DOC +MAP =VAL :key =VAL :value -MAP -DOC -STR
"scalar1"
{
"key": "value"
}
"scalar1"
{
"key": "value"
}
---
nested sequences:
- - - []
- - - {}
key1: []
key2: {}
+STR
+DOC ---
+MAP
=VAL :nested sequences
+SEQ
+SEQ
+SEQ
+SEQ []
-SEQ
-SEQ
-SEQ
+SEQ
+SEQ
+MAP {}
-MAP
-SEQ
-SEQ
-SEQ
=VAL :key1
+SEQ []
-SEQ
=VAL :key2
+MAP {}
-MAP
-MAP
-DOC
-STR
{
"nested sequences": [
[
[
[]
]
],
[
[
{}
]
]
],
"key1": [],
"key2": {}
}
{
"nested sequences": [
[
[
[]
]
],
[
[
{}
]
]
],
"key1": [],
"key2": {}
}
---word1 word2
+STR +DOC =VAL :---word1 word2 -DOC -STR
"---word1 word2"
"---word1 word2"
'implicit block key' : [ 'implicit flow key' : value, ]
+STR
+DOC
+MAP
=VAL 'implicit block key
+SEQ []
+MAP {}
=VAL 'implicit flow key
=VAL :value
-MAP
-SEQ
-MAP
-DOC
-STR
{
"implicit block key": [
{
"implicit flow key": "value"
}
]
}
{
"implicit block key": [
{
"implicit flow key": "value"
}
]
}
--- key ends with two colons::: value
+STR +DOC --- +MAP =VAL :key ends with two colons:: =VAL :value -MAP -DOC -STR
{
"key ends with two colons::": "value"
}
{
"key ends with two colons::": "value"
}
# Comment
+STR -STR
---
- { single line, a: b}
- { multi
line, a: b}
+STR
+DOC ---
+SEQ
+MAP {}
=VAL :single line
=VAL :
=VAL :a
=VAL :b
-MAP
+MAP {}
=VAL :multi line
=VAL :
=VAL :a
=VAL :b
-MAP
-SEQ
-DOC
-STR
[
{
"single line": null,
"a": "b"
},
{
"multi line": null,
"a": "b"
}
]
[
{
"single line": null,
"a": "b"
},
{
"multi line": null,
"a": "b"
}
]
! a
+STR +DOC =VAL <!> :a -DOC -STR
"a"
"a"
key: - item1 - item2
+STR +DOC +MAP =VAL :key +SEQ =VAL :item1 =VAL :item2 -SEQ -MAP -DOC -STR
{
"key": [
"item1",
"item2"
]
}
{
"key": [
"item1",
"item2"
]
}
[
"double
quoted", 'single
quoted',
plain
text, [ nested ],
single: pair,
]
+STR
+DOC
+SEQ []
=VAL "double quoted
=VAL 'single quoted
=VAL :plain text
+SEQ []
=VAL :nested
-SEQ
+MAP {}
=VAL :single
=VAL :pair
-MAP
-SEQ
-DOC
-STR
[
"double quoted",
"single quoted",
"plain text",
[
"nested"
],
{
"single": "pair"
}
]
[
"double quoted",
"single quoted",
"plain text",
[
"nested"
],
{
"single": "pair"
}
]
key: word1 # xxx word2
Yamlrw error: expected mapping key at lines 3-4
--- - &😁 unicode anchor
+STR +DOC --- +SEQ =VAL &😁 :unicode anchor -SEQ -DOC -STR
[ "unicode anchor" ]
[ "unicode anchor" ]
- key: value key2: value2 - key3: value3
+STR +DOC +SEQ +MAP =VAL :key =VAL :value =VAL :key2 =VAL :value2 -MAP +MAP =VAL :key3 =VAL :value3 -MAP -SEQ -DOC -STR
[
{
"key": "value",
"key2": "value2"
},
{
"key3": "value3"
}
]
[
{
"key": "value",
"key2": "value2"
},
{
"key3": "value3"
}
]
--- >- trimmed as space
+STR +DOC --- =VAL >trimmed\n\n\nas space -DOC -STR
"trimmed\n\n\nas space"
"trimmed\n\n\nas space"
--- > Mark McGwire's year was crippled by a knee injury.
+STR +DOC --- =VAL >Mark McGwire's year was crippled by a knee injury.\n -DOC -STR
"Mark McGwire's year was crippled by a knee injury.\n"
"Mark McGwire's year was crippled by a knee injury.\n"
foo: |- bar
+STR +DOC +MAP =VAL :foo =VAL |\tbar -MAP -DOC -STR
{"foo":"\tbar"}
{
"foo": "\tbar"
}
foo: |- bar
+STR +DOC +MAP =VAL :foo =VAL |\tbar -MAP -DOC -STR
{"foo":"\tbar"}
{
"foo": "\tbar"
}
# Comment only.
+STR -STR
---
- { "single line", a: b}
- { "multi
line", a: b}
+STR
+DOC ---
+SEQ
+MAP {}
=VAL "single line
=VAL :
=VAL :a
=VAL :b
-MAP
+MAP {}
=VAL "multi line
=VAL :
=VAL :a
=VAL :b
-MAP
-SEQ
-DOC
-STR
[
{
"single line": null,
"a": "b"
},
{
"multi line": null,
"a": "b"
}
]
[
{
"single line": null,
"a": "b"
},
{
"multi line": null,
"a": "b"
}
]
--- flow: [a, b, c]
Yamlrw error: invalid indentation in flow construct at line 3, columns 1-1
key: - item1 - item2 invalid
Yamlrw error: expected mapping key at line 4, columns 1-1
Mapping: Document --- # Empty ... %YAML 1.2 --- matches %: 20
+STR +DOC +MAP =VAL :Mapping =VAL :Document -MAP -DOC +DOC --- =VAL : -DOC ... +DOC --- +MAP =VAL :matches % =VAL :20 -MAP -DOC -STR
{
"Mapping": "Document"
}
null
{
"matches %": 20
}
{
"Mapping": "Document"
}
null
{
"matches %": 20
}
a:
b:
c: d
e:
f: g
h: i
+STR +DOC +MAP =VAL :a +MAP =VAL :b +MAP =VAL :c =VAL :d -MAP =VAL :e +MAP =VAL :f =VAL :g -MAP -MAP =VAL :h =VAL :i -MAP -DOC -STR
{
"a": {
"b": {
"c": "d"
},
"e": {
"f": "g"
}
},
"h": "i"
}
{
"a": {
"b": {
"c": "d"
},
"e": {
"f": "g"
}
},
"h": "i"
}
!foo "bar" %TAG ! tag:example.com,2000:app/ --- !foo "bar"
Yamlrw error: unexpected token: directives must be separated from document content by document end marker (...) at line 2, columns 1-1
foo: bar: baz
+STR +DOC +MAP =VAL :foo +MAP =VAL :bar =VAL :baz -MAP -MAP -DOC -STR
{
"foo": {
"bar": "baz"
}
}
{
"foo": {
"bar": "baz"
}
}
--- [ a, b, c, ]#invalid
Yamlrw error: comments must be separated from other tokens by whitespace at line 2, columns 13-13
--- &a1 !!str scalar1 --- !!str &a2 scalar2 --- &a3 !!str scalar3 --- &a4 !!map &a5 !!str key5: value4 --- a6: 1 &anchor6 b6: 2 --- !!map &a8 !!str key8: value7 --- !!map !!str &a10 key10: value9 --- !!str &a11 value11
+STR +DOC --- =VAL &a1 <tag:yaml.org,2002:str> :scalar1 -DOC +DOC --- =VAL &a2 <tag:yaml.org,2002:str> :scalar2 -DOC +DOC --- =VAL &a3 <tag:yaml.org,2002:str> :scalar3 -DOC +DOC --- +MAP &a4 <tag:yaml.org,2002:map> =VAL &a5 <tag:yaml.org,2002:str> :key5 =VAL :value4 -MAP -DOC +DOC --- +MAP =VAL :a6 =VAL :1 =VAL &anchor6 :b6 =VAL :2 -MAP -DOC +DOC --- +MAP <tag:yaml.org,2002:map> =VAL &a8 <tag:yaml.org,2002:str> :key8 =VAL :value7 -MAP -DOC +DOC --- +MAP <tag:yaml.org,2002:map> =VAL &a10 <tag:yaml.org,2002:str> :key10 =VAL :value9 -MAP -DOC +DOC --- =VAL &a11 <tag:yaml.org,2002:str> :value11 -DOC -STR
"scalar1"
"scalar2"
"scalar3"
{
"key5": "value4"
}
{
"a6": 1,
"b6": 2
}
{
"key8": "value7"
}
{
"key10": "value9"
}
"value11"
"scalar1"
"scalar2"
"scalar3"
{
"key5": "value4"
}
{
"a6": 1,
"b6": 2
}
{
"key8": "value7"
}
{
"key10": "value9"
}
"value11"
--- key1: value1
key2: value2
Yamlrw error: expected mapping key at line 1, columns 9-9
--- [ , a, b, c ]
Yamlrw error: unexpected token: unexpected ',' in flow sequence at line 2, columns 3-4
%YAML 1.2
Yamlrw error: expected document start '---' at line 2, columns 1-1
- [ YAML : separate ]
- [ "JSON like":adjacent ]
- [ {JSON: like}:adjacent ]
+STR
+DOC
+SEQ
+SEQ []
+MAP {}
=VAL :YAML
=VAL :separate
-MAP
-SEQ
+SEQ []
+MAP {}
=VAL "JSON like
=VAL :adjacent
-MAP
-SEQ
+SEQ []
+MAP {}
+MAP {}
=VAL :JSON
=VAL :like
-MAP
=VAL :adjacent
-MAP
-SEQ
-SEQ
-DOC
-STR
--- "a ...x b"
+STR +DOC --- =VAL "a ...x b -DOC -STR
"a ...x b"
"a ...x b"
--- "a ... x b"
Yamlrw error: unclosed double quote at line 1, columns 5-5
"a ...x b"
---
- { "single line": value}
- { "multi
line": value}
+STR
+DOC ---
+SEQ
+MAP {}
=VAL "single line
=VAL :value
-MAP
+MAP {}
=VAL "multi line
=VAL :value
-MAP
-SEQ
-DOC
-STR
[
{
"single line": "value"
},
{
"multi line": "value"
}
]
[
{
"single line": "value"
},
{
"multi line": "value"
}
]
single: 'text' double: "text"
+STR +DOC +MAP =VAL :single =VAL 'text =VAL :double =VAL "text -MAP -DOC -STR
{
"single": "text",
"double": "text"
}
{
"single": "text",
"double": "text"
}
--- " 1st non-empty 2nd non-empty 3rd non-empty "
+STR +DOC --- =VAL " 1st non-empty\n2nd non-empty 3rd non-empty -DOC -STR
" 1st non-empty\n2nd non-empty 3rd non-empty "
" 1st non-empty\n2nd non-empty 3rd non-empty "
--- # Products purchased - item : Super Hoop quantity: 1 - item : Basketball quantity: 4 - item : Big Shoes quantity: 1
+STR +DOC --- +SEQ +MAP =VAL :item =VAL :Super Hoop =VAL :quantity =VAL :1 -MAP +MAP =VAL :item =VAL :Basketball =VAL :quantity =VAL :4 -MAP +MAP =VAL :item =VAL :Big Shoes =VAL :quantity =VAL :1 -MAP -SEQ -DOC -STR
[
{
"item": "Super Hoop",
"quantity": 1
},
{
"item": "Basketball",
"quantity": 4
},
{
"item": "Big Shoes",
"quantity": 1
}
]
[
{
"item": "Super Hoop",
"quantity": 1
},
{
"item": "Basketball",
"quantity": 4
},
{
"item": "Big Shoes",
"quantity": 1
}
]
# Private !foo "bar" ... # Global %TAG ! tag:example.com,2000:app/ --- !foo "bar"
+STR +DOC =VAL <!foo> "bar -DOC ... +DOC --- =VAL <tag:example.com,2000:app/foo> "bar -DOC -STR
"bar" "bar"
"bar" "bar"
a b c d e
+STR +DOC =VAL :a b c d\ne -DOC -STR
"a b c d\ne"
"a b c d\ne"
? a
: - b
- - c
- d
+STR +DOC +MAP =VAL :a +SEQ =VAL :b +SEQ =VAL :c =VAL :d -SEQ -SEQ -MAP -DOC -STR
{
"a": [
"b",
[
"c",
"d"
]
]
}
{
"a": [
"b",
[
"c",
"d"
]
]
}
strip: |- text clip: | text keep: |+ text
+STR +DOC +MAP =VAL :strip =VAL |text =VAL :clip =VAL |text\n =VAL :keep =VAL |text\n -MAP -DOC -STR
{
"strip": "text",
"clip": "text\n",
"keep": "text\n"
}
{
"strip": "text",
"clip": "text\n",
"keep": "text\n"
}
a: b c d: e f
+STR +DOC +MAP =VAL :a =VAL :b c =VAL :d =VAL :e f -MAP -DOC -STR
{
"a": "b c",
"d": "e f"
}
{
"a": "b c",
"d": "e f"
}
- single multiline - sequence entry
+STR +DOC +SEQ =VAL :single multiline - sequence entry -SEQ -DOC -STR
[ "single multiline - sequence entry" ]
[ "single multiline - sequence entry" ]
+STR -STR
one: - 2 - 3 four: 5
+STR +DOC +MAP =VAL :one +SEQ =VAL :2 =VAL :3 -SEQ =VAL :four =VAL :5 -MAP -DOC -STR
{
"one": [
2,
3
],
"four": 5
}
{
"one": [
2,
3
],
"four": 5
}
- bla"keks: foo - bla]keks: foo
+STR +DOC +SEQ +MAP =VAL :bla"keks =VAL :foo -MAP +MAP =VAL :bla]keks =VAL :foo -MAP -SEQ -DOC -STR
[
{
"bla\"keks": "foo"
},
{
"bla]keks": "foo"
}
]
[
{
"bla\"keks": "foo"
},
{
"bla]keks": "foo"
}
]
--- > folded text
+STR +DOC --- =VAL >folded text\n -DOC -STR
"folded text\n"
"folded text\n"
%YAML 1.2 ...
Yamlrw error: expected document start '---' at line 2, columns 1-4
- item1 - item2 invalid: x
Yamlrw error: expected block entry '-' at line 3, columns 1-1
%YAML 1.3 # Attempt parsing
# with a warning
---
"foo"
+STR +DOC --- =VAL "foo -DOC -STR
"foo"
"foo"
---
plain: a
b # end of scalar
c
Yamlrw error: expected mapping key at lines 4-5
word1 # comment word2
Yamlrw error: unexpected token: content not allowed after document value at lines 2-3
key: &anchor !!map a: b
+STR +DOC +MAP =VAL :key +MAP &anchor <tag:yaml.org,2002:map> =VAL :a =VAL :b -MAP -MAP -DOC -STR
{
"key": {
"a": "b"
}
}
{
"key": {
"a": "b"
}
}
{
"adjacent":value,
"readable": value,
"empty":
}
+STR
+DOC
+MAP {}
=VAL "adjacent
=VAL :value
=VAL "readable
=VAL :value
=VAL "empty
=VAL :
-MAP
-DOC
-STR
{
"adjacent": "value",
"readable": "value",
"empty": null
}
{
"adjacent": "value",
"readable": "value",
"empty": null
}
[23 ]: 42
Yamlrw error: expected mapping key at line 2, columns 2-2
%TAG ! tag:clarkevans.com,2002:
--- !shape
# Use the ! handle for presenting
# tag:clarkevans.com,2002:circle
- !circle
center: &ORIGIN {x: 73, y: 129}
radius: 7
- !line
start: *ORIGIN
finish: { x: 89, y: 102 }
- !label
start: *ORIGIN
color: 0xFFEEBB
text: Pretty vector drawing.
+STR
+DOC ---
+SEQ <tag:clarkevans.com,2002:shape>
+MAP <tag:clarkevans.com,2002:circle>
=VAL :center
+MAP {} &ORIGIN
=VAL :x
=VAL :73
=VAL :y
=VAL :129
-MAP
=VAL :radius
=VAL :7
-MAP
+MAP <tag:clarkevans.com,2002:line>
=VAL :start
=ALI *ORIGIN
=VAL :finish
+MAP {}
=VAL :x
=VAL :89
=VAL :y
=VAL :102
-MAP
-MAP
+MAP <tag:clarkevans.com,2002:label>
=VAL :start
=ALI *ORIGIN
=VAL :color
=VAL :0xFFEEBB
=VAL :text
=VAL :Pretty vector drawing.
-MAP
-SEQ
-DOC
-STR
[
{
"center": {
"x": 73,
"y": 129
},
"radius": 7
},
{
"start": {
"x": 73,
"y": 129
},
"finish": {
"x": 89,
"y": 102
}
},
{
"start": {
"x": 73,
"y": 129
},
"color": 16772795,
"text": "Pretty vector drawing."
}
]
[
{
"center": {
"x": 73,
"y": 129
},
"radius": 7
},
{
"start": {
"x": 73,
"y": 129
},
"finish": {
"x": 89,
"y": 102
}
},
{
"start": {
"x": 73,
"y": 129
},
"color": 16772795,
"text": "Pretty vector drawing."
}
]
%TAG !e! tag:example.com,2000:app/ --- !e!foo "bar"
+STR +DOC --- =VAL <tag:example.com,2000:app/foo> "bar -DOC -STR
"bar"
"bar"
- [ : empty key ] - [: another empty key]
+STR
+DOC
+SEQ
+SEQ []
+MAP {}
=VAL :
=VAL :empty key
-MAP
-SEQ
+SEQ []
+MAP {}
=VAL :
=VAL :another empty key
-MAP
-SEQ
-SEQ
-DOC
-STR
key: [ word1 # xxx word2 ]
Yamlrw error: expected sequence end ']' at line 3, columns 3-9
&flowseq [
a: b,
&c c: d,
{ &e e: f },
&g { g: h }
]
+STR
+DOC
+SEQ [] &flowseq
+MAP {}
=VAL :a
=VAL :b
-MAP
+MAP {}
=VAL &c :c
=VAL :d
-MAP
+MAP {}
=VAL &e :e
=VAL :f
-MAP
+MAP {} &g
=VAL :g
=VAL :h
-MAP
-SEQ
-DOC
-STR
[
{
"a": "b"
},
{
"c": "d"
},
{
"e": "f"
},
{
"g": "h"
}
]
[
{
"a": "b"
},
{
"c": "d"
},
{
"e": "f"
},
{
"g": "h"
}
]
--- tab: "\tstring"
+STR +DOC --- +MAP =VAL :tab =VAL "\tstring -MAP -DOC -STR
{
"tab": "\tstring"
}
{
"tab": "\tstring"
}
--- key: "missing closing quote
Yamlrw error: unclosed double quote at line 2, columns 6-6
[ ? foo bar : baz ]
+STR
+DOC
+SEQ []
+MAP {}
=VAL :foo bar
=VAL :baz
-MAP
-SEQ
-DOC
-STR
[
{
"foo bar": "baz"
}
]
[
{
"foo bar": "baz"
}
]
--- [ a, b, c, , ]
Yamlrw error: unexpected token: unexpected ',' in flow sequence at line 2, columns 12-13
anchored: !local &anchor value alias: *anchor
+STR +DOC +MAP =VAL :anchored =VAL &anchor <!local> :value =VAL :alias =ALI *anchor -MAP -DOC -STR
{
"anchored": "value",
"alias": "value"
}
{
"anchored": "value",
"alias": "value"
}
--- [ a, b, c,#invalid ]
Yamlrw error: comments must be separated from other tokens by whitespace at line 2, columns 11-11
--- &anchor a: b
Yamlrw error: expected mapping key at line 1, columns 14-14
'a\nb': 1 'c d': 1
Yamlrw error: expected mapping key at line 2, columns 1-1
- |2- explicit indent and chomp - |-2 chomp and explicit indent
+STR +DOC +SEQ =VAL |explicit indent and chomp =VAL |chomp and explicit indent -SEQ -DOC -STR
[ "explicit indent and chomp", "chomp and explicit indent" ]
[ "explicit indent and chomp", "chomp and explicit indent" ]
a: [b, c]
+STR +DOC +MAP =VAL :a +SEQ [] =VAL :b =VAL :c -SEQ -MAP -DOC -STR
{
"a": [
"b",
"c"
]
}
{
"a": [
"b",
"c"
]
}
foo: bar
+STR +DOC +MAP =VAL :foo =VAL :bar -MAP -DOC -STR
{
"foo": "bar"
}
{
"foo": "bar"
}
# Outside flow collection: - ::vector - ": - ()" - Up, up, and away! - -123 - http://example.com/foo#bar # Inside flow collection: - [ ::vector, ": - ()", "Up, up and away!", -123, http://example.com/foo#bar ]
+STR +DOC +SEQ =VAL :::vector =VAL ": - () =VAL :Up, up, and away! =VAL :-123 =VAL :http://example.com/foo#bar +SEQ [] =VAL :::vector =VAL ": - () =VAL "Up, up and away! =VAL :-123 =VAL :http://example.com/foo#bar -SEQ -SEQ -DOC -STR
[
"::vector",
": - ()",
"Up, up, and away!",
-123,
"http://example.com/foo#bar",
[
"::vector",
": - ()",
"Up, up and away!",
-123,
"http://example.com/foo#bar"
]
]
[
"::vector",
": - ()",
"Up, up, and away!",
-123,
"http://example.com/foo#bar",
[
"::vector",
": - ()",
"Up, up and away!",
-123,
"http://example.com/foo#bar"
]
]
a: b seq: - a c: d #X
+STR +DOC +MAP =VAL :a =VAL :b =VAL :seq +SEQ =VAL :a -SEQ =VAL :c =VAL :d -MAP -DOC -STR
{
"a": "b",
"seq": [
"a"
],
"c": "d"
}
{
"a": "b",
"seq": [
"a"
],
"c": "d"
}
"1 trailing\t
tab"
+STR +DOC =VAL "1 trailing\t tab -DOC -STR
"1 trailing\t tab"
"1 trailing\t tab"
"2 trailing\t
tab"
+STR +DOC =VAL "2 trailing\t tab -DOC -STR
"2 trailing\t tab"
"2 trailing\t tab"
"3 trailing\
tab"
+STR +DOC =VAL "3 trailing\t tab -DOC -STR
"3 trailing\t tab"
"3 trailing\t tab"
"4 trailing\
tab"
+STR +DOC =VAL "4 trailing\t tab -DOC -STR
"4 trailing\t tab"
"4 trailing\t tab"
"5 trailing
tab"
+STR +DOC =VAL "5 trailing tab -DOC -STR
"5 trailing tab"
"5 trailing tab"
"6 trailing
tab"
+STR +DOC =VAL "6 trailing tab -DOC -STR
"6 trailing tab"
"6 trailing tab"
{
? explicit: entry,
implicit: entry,
?
}
+STR
+DOC
+MAP {}
=VAL :explicit
=VAL :entry
=VAL :implicit
=VAL :entry
=VAL :
=VAL :
-MAP
-DOC
-STR
[foo, bar, 42]
+STR +DOC +SEQ [] =VAL :foo =VAL :bar =VAL :42 -SEQ -DOC -STR
[ "foo", "bar", 42 ]
[ "foo", "bar", 42 ]
--- > line1 # no comment line3
+STR +DOC --- =VAL >line1 # no comment line3\n -DOC -STR
"line1 # no comment line3\n"
"line1 # no comment line3\n"
--- [ key : value ]
Yamlrw error: key and ':' must be on the same line in flow context at line 3, columns 3-3
foo: bar
+STR +DOC +MAP =VAL :foo =VAL :bar -MAP -DOC -STR
{
"foo" : "bar"
}
{
"foo": "bar"
}
foo: "bar baz"
Yamlrw error: invalid indentation in quoted scalar at line 2, columns 2-2
{
"foo" : "bar"
}
foo: "bar baz"
+STR +DOC +MAP =VAL :foo =VAL "bar baz -MAP -DOC -STR
{
"foo" : "bar baz"
}
{
"foo": "bar baz"
}
foo: 1
+STR +DOC +MAP =VAL :foo =VAL :1 -MAP -DOC -STR
{
"foo" : 1
}
{
"foo": 1
}
foo: 1 bar: 2
+STR +DOC +MAP =VAL :foo =VAL :1 =VAL :bar =VAL :2 -MAP -DOC -STR
{
"foo" : 1,
"bar" : 2
}
{
"foo": 1,
"bar": 2
}
foo: 1 bar: 2
+STR +DOC +MAP =VAL :foo =VAL :1 =VAL :bar =VAL :2 -MAP -DOC -STR
{
"foo" : 1,
"bar" : 2
}
{
"foo": 1,
"bar": 2
}
foo: a: 1 b: 2
Yamlrw error: expected mapping key at line 3, columns 5-5
{
"foo" : 1,
"bar" : 2
}
%YAML 1.2 ---
+STR +DOC --- =VAL : -DOC -STR
null
null
foo: "bar baz "
+STR +DOC +MAP =VAL :foo =VAL "bar baz \t \t -MAP -DOC -STR
{
"foo" : "bar baz \t \t "
}
{
"foo": "bar baz \t \t "
}
key: ok: 1 wrong: 2
Yamlrw error: expected mapping key at line 3, columns 2-2
| literal text # Comment
+STR +DOC =VAL |\n\nliteral\n \n\ntext\n -DOC -STR
"\n\nliteral\n \n\ntext\n"
"\n\nliteral\n \n\ntext\n"
&a a: &b b *b : *a
+STR +DOC +MAP =VAL &a :a =VAL &b :b =ALI *b =ALI *a -MAP -DOC -STR
{
"a": "b",
"b": "a"
}
{
"a": "b",
"b": "a"
}
--- scalar1 # comment %YAML 1.2 --- scalar2
Yamlrw error: unexpected token: directives must be separated from document content by document end marker (...) at line 3, columns 1-1
!!map {
k: !!seq
[ a, !!str b]
}
+STR
+DOC
+MAP {} <tag:yaml.org,2002:map>
=VAL :k
+SEQ [] <tag:yaml.org,2002:seq>
=VAL :a
=VAL <tag:yaml.org,2002:str> :b
-SEQ
-MAP
-DOC
-STR
{
"k": [
"a",
"b"
]
}
{
"k": [
"a",
"b"
]
}
k1: v1 k2: v2
Yamlrw error: expected mapping key at line 2, columns 4-4
--- a b c d e
+STR +DOC --- =VAL :a b c d\ne -DOC -STR
"a b c d\ne"
"a b c d\ne"
--- ---word1 word2
+STR +DOC --- =VAL :---word1 word2 -DOC -STR
"---word1 word2"
"---word1 word2"
- &a !!str a - !!int 2 - !!int &c 4 - &d d
+STR +DOC +SEQ =VAL &a <tag:yaml.org,2002:str> :a =VAL <tag:yaml.org,2002:int> :2 =VAL &c <tag:yaml.org,2002:int> :4 =VAL &d :d -SEQ -DOC -STR
[ "a", 2, 4, "d" ]
[ "a", 2, 4, "d" ]
---
{ a: [b, c, { d: [e, f] } ] }
+STR
+DOC ---
+MAP {}
=VAL :a
+SEQ []
=VAL :b
=VAL :c
+MAP {}
=VAL :d
+SEQ []
=VAL :e
=VAL :f
-SEQ
-MAP
-SEQ
-MAP
-DOC
-STR
{
"a": [
"b",
"c",
{
"d": [
"e",
"f"
]
}
]
}
{
"a": [
"b",
"c",
{
"d": [
"e",
"f"
]
}
]
}
--- a: >2 more indented regular b: >2 more indented regular
+STR +DOC --- +MAP =VAL :a =VAL > more indented\nregular\n =VAL :b =VAL >\n\n more indented\nregular\n -MAP -DOC -STR
{
"a": " more indented\nregular\n",
"b": "\n\n more indented\nregular\n"
}
{
"a": " more indented\nregular\n",
"b": "\n\n more indented\nregular\n"
}
# Strip # Comments: strip: |- # text # Clip # comments: clip: | # text # Keep # comments: keep: |+ # text # Trail # comments.
+STR +DOC +MAP =VAL :strip =VAL |# text =VAL :clip =VAL |# text\n =VAL :keep =VAL |# text\n\n -MAP -DOC -STR
{
"strip": "# text",
"clip": "# text\n",
"keep": "# text\n\n"
}
{
"strip": "# text",
"clip": "# text\n",
"keep": "# text\n\n"
}
safe: a!"#$%&'()*+,-./09:;<=>?@AZ[\]^_`az{|}~
!"#$%&'()*+,-./09:;<=>?@AZ[\]^_`az{|}~
safe question mark: ?foo
safe colon: :foo
safe dash: -foo
+STR
+DOC
+MAP
=VAL :safe
=VAL :a!"#$%&'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~ !"#$%&'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~
=VAL :safe question mark
=VAL :?foo
=VAL :safe colon
=VAL ::foo
=VAL :safe dash
=VAL :-foo
-MAP
-DOC
-STR
{
"safe": "a!\"#$%&'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~ !\"#$%&'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~",
"safe question mark": "?foo",
"safe colon": ":foo",
"safe dash": "-foo"
}
{
"safe": "a!\"#$%&'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~ !\"#$%&'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~",
"safe question mark": "?foo",
"safe colon": ":foo",
"safe dash": "-foo"
}
- !!str - !!null : a b: !!str - !!str : !!null
+STR +DOC +SEQ =VAL <tag:yaml.org,2002:str> : +MAP =VAL <tag:yaml.org,2002:null> : =VAL :a =VAL :b =VAL <tag:yaml.org,2002:str> : -MAP +MAP =VAL <tag:yaml.org,2002:str> : =VAL <tag:yaml.org,2002:null> : -MAP -SEQ -DOC -STR
--- > line1 line2 line3
+STR +DOC --- =VAL >line1 line2 line3\n -DOC -STR
"line1 line2 line3\n"
"line1 line2 line3\n"
- Mark McGwire - Sammy Sosa - Ken Griffey
+STR +DOC +SEQ =VAL :Mark McGwire =VAL :Sammy Sosa =VAL :Ken Griffey -SEQ -DOC -STR
[ "Mark McGwire", "Sammy Sosa", "Ken Griffey" ]
[ "Mark McGwire", "Sammy Sosa", "Ken Griffey" ]
{
? foo :,
: bar,
}
+STR
+DOC
+MAP {}
=VAL :foo
=VAL :
=VAL :
=VAL :bar
-MAP
-DOC
-STR
--- &sequence - a
+STR +DOC --- +SEQ &sequence =VAL :a -SEQ -DOC -STR
[ "a" ]
[ "a" ]
[a, [b, c]]
+STR +DOC +SEQ [] =VAL :a +SEQ [] =VAL :b =VAL :c -SEQ -SEQ -DOC -STR
[
"a",
[
"b",
"c"
]
]
[
"a",
[
"b",
"c"
]
]
unicode: "Sosa did fine.\u263A" control: "\b1998\t1999\t2000\n" hex esc: "\x0d\x0a is \r\n" single: '"Howdy!" he cried.' quoted: ' # Not a ''comment''.' tie-fighter: '|\-*-/|'
+STR +DOC +MAP =VAL :unicode =VAL "Sosa did fine.☺ =VAL :control =VAL "\b1998\t1999\t2000\n =VAL :hex esc =VAL "\r\n is \r\n =VAL :single =VAL '"Howdy!" he cried. =VAL :quoted =VAL ' # Not a 'comment'. =VAL :tie-fighter =VAL '|\\-*-/| -MAP -DOC -STR
{
"unicode": "Sosa did fine.☺",
"control": "\b1998\t1999\t2000\n",
"hex esc": "\r\n is \r\n",
"single": "\"Howdy!\" he cried.",
"quoted": " # Not a 'comment'.",
"tie-fighter": "|\\-*-/|"
}
{
"unicode": "Sosa did fine.☺",
"control": "\b1998\t1999\t2000\n",
"hex esc": "\r\n is \r\n",
"single": "\"Howdy!\" he cried.",
"quoted": " # Not a 'comment'.",
"tie-fighter": "|\\-*-/|"
}
--- - [-, -]
Yamlrw error: unexpected character '-' at line 2, columns 4-4
a\nb: 1 c d: 1
Yamlrw error: expected mapping key at line 2, columns 1-1
> folded text
+STR +DOC =VAL >folded text\n -DOC -STR
"folded text\n"
"folded text\n"
--- seq: &anchor - a - b
Yamlrw error: expected mapping key at line 3, columns 1-1
key: value this is #not a: key
Yamlrw error: expected mapping key at line 2, columns 1-1
? a : 1.3 fifteen: d
+STR +DOC +MAP =VAL :a =VAL :1.3 =VAL :fifteen =VAL :d -MAP -DOC -STR
{
"a": 1.3,
"fifteen": "d"
}
{
"a": 1.3,
"fifteen": "d"
}
- item1 &node - item2
Yamlrw error: expected mapping key at line 2, columns 1-1
foo: 1
bar: 2
text: |
a
b
c
d
+STR +DOC +MAP =VAL :foo =VAL :1 =VAL :bar =VAL :2 =VAL :text =VAL |a\n \nb\n\nc\n\nd\n -MAP -DOC -STR
{
"foo": 1,
"bar": 2,
"text": "a\n \nb\n\nc\n\nd\n"
}
{
"foo": 1,
"bar": 2,
"text": "a\n \nb\n\nc\n\nd\n"
}
--- wanted: love ♥ and peace ☮
+STR +DOC --- +MAP =VAL :wanted =VAL :love ♥ and peace ☮ -MAP -DOC -STR
{
"wanted": "love ♥ and peace ☮"
}
{
"wanted": "love ♥ and peace ☮"
}
key: &x !!map a: b
Yamlrw error: expected mapping key at line 2, columns 1-1
%YAML 1.2 foo ---
Yamlrw error: invalid directive: expected comment or line break after version at line 1, columns 11-11
[:x]
+STR +DOC +SEQ [] =VAL ::x -SEQ -DOC -STR
[ ":x" ]
[ ":x" ]
[?x]
+STR +DOC +SEQ [] =VAL :?x -SEQ -DOC -STR
[ "?x" ]
[ "?x" ]
name: Mark McGwire accomplishment: > Mark set a major league home run record in 1998. stats: | 65 Home Runs 0.278 Batting Average
+STR +DOC +MAP =VAL :name =VAL :Mark McGwire =VAL :accomplishment =VAL >Mark set a major league home run record in 1998.\n =VAL :stats =VAL |65 Home Runs\n0.278 Batting Average\n -MAP -DOC -STR
{
"name": "Mark McGwire",
"accomplishment": "Mark set a major league home run record in 1998.\n",
"stats": "65 Home Runs\n0.278 Batting Average\n"
}
{
"name": "Mark McGwire",
"accomplishment": "Mark set a major league home run record in 1998.\n",
"stats": "65 Home Runs\n0.278 Batting Average\n"
}
!!str &a1 "foo": !!str bar &a2 baz : *a1
+STR +DOC +MAP =VAL &a1 <tag:yaml.org,2002:str> "foo =VAL <tag:yaml.org,2002:str> :bar =VAL &a2 :baz =ALI *a1 -MAP -DOC -STR
{
"foo": "bar",
"baz": "foo"
}
{
"foo": "bar",
"baz": "foo"
}
--- double: "quoted \' scalar"
Yamlrw error: invalid escape sequence: \' at line 2, columns 18-18
1st non-empty 2nd non-empty 3rd non-empty
+STR +DOC =VAL :1st non-empty\n2nd non-empty 3rd non-empty -DOC -STR
"1st non-empty\n2nd non-empty 3rd non-empty"
"1st non-empty\n2nd non-empty 3rd non-empty"
key: word1 word2 no: key
Yamlrw error: expected mapping key at line 3, columns 5-5
...
+STR -STR
# Tabs and spaces
quoted: "Quoted "
block: |
void main() {
printf("Hello, world!\n");
}
+STR
+DOC
+MAP
=VAL :quoted
=VAL "Quoted \t
=VAL :block
=VAL |void main() {\n\tprintf("Hello, world!\\n");\n}\n
-MAP
-DOC
-STR
{
"quoted": "Quoted \t",
"block": "void main() {\n\tprintf(\"Hello, world!\\n\");\n}\n"
}
{
"quoted": "Quoted \t",
"block": "void main() {\n\tprintf(\"Hello, world!\\n\");\n}\n"
}
foo: blue bar: arrr baz: jazz
+STR +DOC +MAP =VAL :foo =VAL :blue =VAL :bar =VAL :arrr =VAL :baz =VAL :jazz -MAP -DOC -STR
{
"foo": "blue",
"bar": "arrr",
"baz": "jazz"
}
{
"foo": "blue",
"bar": "arrr",
"baz": "jazz"
}
# The !!omap tag is one of the optional types # introduced for YAML 1.1. In 1.2, it is not # part of the standard tags and should not be # enabled by default. # Ordered maps are represented as # A sequence of mappings, with # each mapping having one key --- !!omap - Mark McGwire: 65 - Sammy Sosa: 63 - Ken Griffy: 58
+STR +DOC --- +SEQ <tag:yaml.org,2002:omap> +MAP =VAL :Mark McGwire =VAL :65 -MAP +MAP =VAL :Sammy Sosa =VAL :63 -MAP +MAP =VAL :Ken Griffy =VAL :58 -MAP -SEQ -DOC -STR
[
{
"Mark McGwire": 65
},
{
"Sammy Sosa": 63
},
{
"Ken Griffy": 58
}
]
[
{
"Mark McGwire": 65
},
{
"Sammy Sosa": 63
},
{
"Ken Griffy": 58
}
]
one: 2 three: 4
+STR +DOC +MAP =VAL :one =VAL :2 =VAL :three =VAL :4 -MAP -DOC -STR
{
"one": 2,
"three": 4
}
{
"one": 2,
"three": 4
}
--- hr: # 1998 hr ranking - Mark McGwire - Sammy Sosa rbi: # 1998 rbi ranking - Sammy Sosa - Ken Griffey
+STR +DOC --- +MAP =VAL :hr +SEQ =VAL :Mark McGwire =VAL :Sammy Sosa -SEQ =VAL :rbi +SEQ =VAL :Sammy Sosa =VAL :Ken Griffey -SEQ -MAP -DOC -STR
{
"hr": [
"Mark McGwire",
"Sammy Sosa"
],
"rbi": [
"Sammy Sosa",
"Ken Griffey"
]
}
{
"hr": [
"Mark McGwire",
"Sammy Sosa"
],
"rbi": [
"Sammy Sosa",
"Ken Griffey"
]
}
- |+
+STR +DOC +SEQ =VAL |\n\n -SEQ -DOC -STR
[ "\n\n" ]
[ "\n\n" ]
- |+
+STR +DOC +SEQ =VAL |\n -SEQ -DOC -STR
[ "\n" ]
[ "\n" ]
- |+
+STR +DOC +SEQ =VAL |\n -SEQ -DOC -STR
[ "\n" ]
[ "\n" ]
# Ranking of 1998 home runs --- - Mark McGwire - Sammy Sosa - Ken Griffey # Team ranking --- - Chicago Cubs - St Louis Cardinals
+STR +DOC --- +SEQ =VAL :Mark McGwire =VAL :Sammy Sosa =VAL :Ken Griffey -SEQ -DOC +DOC --- +SEQ =VAL :Chicago Cubs =VAL :St Louis Cardinals -SEQ -DOC -STR
[ "Mark McGwire", "Sammy Sosa", "Ken Griffey" ] [ "Chicago Cubs", "St Louis Cardinals" ]
[ "Mark McGwire", "Sammy Sosa", "Ken Griffey" ] [ "Chicago Cubs", "St Louis Cardinals" ]
- - "bar bar": x
Yamlrw error: invalid indentation in quoted scalar at line 2, columns 1-1
block sequence: - one - two : three
+STR +DOC +MAP =VAL :block sequence +SEQ =VAL :one +MAP =VAL :two =VAL :three -MAP -SEQ -MAP -DOC -STR
{
"block sequence": [
"one",
{
"two": "three"
}
]
}
{
"block sequence": [
"one",
{
"two": "three"
}
]
}
- a?string
- another ? string
- key: value?
- [a?string]
- [another ? string]
- {key: value? }
- {key: value?}
- {key?: value }
+STR
+DOC
+SEQ
=VAL :a?string
=VAL :another ? string
+MAP
=VAL :key
=VAL :value?
-MAP
+SEQ []
=VAL :a?string
-SEQ
+SEQ []
=VAL :another ? string
-SEQ
+MAP {}
=VAL :key
=VAL :value?
-MAP
+MAP {}
=VAL :key
=VAL :value?
-MAP
+MAP {}
=VAL :key?
=VAL :value
-MAP
-SEQ
-DOC
-STR
[
"a?string",
"another ? string",
{
"key": "value?"
},
[
"a?string"
],
[
"another ? string"
],
{
"key": "value?"
},
{
"key": "value?"
},
{
"key?": "value"
}
]
[
"a?string",
"another ? string",
{
"key": "value?"
},
[
"a?string"
],
[
"another ? string"
],
{
"key": "value?"
},
{
"key": "value?"
},
{
"key?": "value"
}
]
First occurrence: &anchor Value Second occurrence: *anchor
+STR +DOC +MAP =VAL :First occurrence =VAL &anchor :Value =VAL :Second occurrence =ALI *anchor -MAP -DOC -STR
{
"First occurrence": "Value",
"Second occurrence": "Value"
}
{
"First occurrence": "Value",
"Second occurrence": "Value"
}
? a true : null d ? e 42
+STR +DOC +MAP =VAL :a true =VAL :null d =VAL :e 42 =VAL : -MAP -DOC -STR
{
"a true": "null d",
"e 42": null
}
{
"a true": "null d",
"e 42": null
}
key1: "quoted1" key2: "quoted2" no key: nor value key3: "quoted3"
Yamlrw error: expected mapping key at line 2, columns 17-23
---
{ "foo" # comment
:bar }
+STR
+DOC ---
+MAP {}
=VAL "foo
=VAL :bar
-MAP
-DOC
-STR
{
"foo": "bar"
}
{
"foo": "bar"
}
- foo - bar - 42
+STR +DOC +SEQ =VAL :foo =VAL :bar =VAL :42 -SEQ -DOC -STR
[ "foo", "bar", 42 ]
[ "foo", "bar", 42 ]
>- trimmed as space
+STR +DOC =VAL >trimmed\n\n\nas space -DOC -STR
"trimmed\n\n\nas space"
"trimmed\n\n\nas space"
--- scalar
+STR +DOC --- =VAL :scalar -DOC -STR
"scalar"
"scalar"
strip: >- clip: > keep: |+
+STR +DOC +MAP =VAL :strip =VAL > =VAL :clip =VAL > =VAL :keep =VAL |\n -MAP -DOC -STR
{
"strip": "",
"clip": "",
"keep": "\n"
}
{
"strip": "",
"clip": "",
"keep": "\n"
}
"1 inline\ttab"
+STR +DOC =VAL "1 inline\ttab -DOC -STR
"1 inline\ttab"
"1 inline\ttab"
"2 inline\ tab"
+STR +DOC =VAL "2 inline\ttab -DOC -STR
"2 inline\ttab"
"2 inline\ttab"
"3 inline tab"
+STR +DOC =VAL "3 inline\ttab -DOC -STR
"3 inline\ttab"
"3 inline\ttab"
complex1:
? - a
complex2:
? - a
: b
complex3:
? - a
: >
b
complex4:
? >
a
:
complex5:
? - a
: - b
+STR +DOC +MAP =VAL :complex1 +MAP +SEQ =VAL :a -SEQ =VAL : -MAP =VAL :complex2 +MAP +SEQ =VAL :a -SEQ =VAL :b -MAP =VAL :complex3 +MAP +SEQ =VAL :a -SEQ =VAL >b\n -MAP =VAL :complex4 +MAP =VAL >a\n =VAL : -MAP =VAL :complex5 +MAP +SEQ =VAL :a -SEQ +SEQ =VAL :b -SEQ -MAP -MAP -DOC -STR
foo: bar: 1 baz: 2
+STR +DOC +MAP =VAL :foo +MAP =VAL :bar =VAL :1 -MAP =VAL :baz =VAL :2 -MAP -DOC -STR
{
"foo": {
"bar": 1
},
"baz": 2
}
{
"foo": {
"bar": 1
},
"baz": 2
}
--- [ sequence item ] invalid item
Yamlrw error: unexpected token: content not allowed after document value at lines 5-6
--- "quoted string" --- &node foo
+STR +DOC --- =VAL "quoted string -DOC +DOC --- =VAL &node :foo -DOC -STR
"quoted string" "foo"
"quoted string" "foo"
foo: | x
+STR +DOC +MAP =VAL :foo =VAL |x\n \n -MAP -DOC -STR
{
"foo" : "x\n \n"
}
{
"foo": "x\n \n"
}
foo: | x
+STR +DOC +MAP =VAL :foo =VAL |x\n \n -MAP -DOC -STR
{
"foo" : "x\n \n"
}
{
"foo": "x\n \n"
}
--- foo # comment --- foo # comment
+STR +DOC --- =VAL :foo -DOC +DOC --- =VAL :foo -DOC -STR
"foo" "foo"
"foo" "foo"
? !!str a : !!int 47 ? c : !!str d
+STR +DOC +MAP =VAL <tag:yaml.org,2002:str> :a =VAL <tag:yaml.org,2002:int> :47 =VAL :c =VAL <tag:yaml.org,2002:str> :d -MAP -DOC -STR
{
"a": 47,
"c": "d"
}
{
"a": 47,
"c": "d"
}
implicit block key : [ implicit flow key : value, ]
+STR
+DOC
+MAP
=VAL :implicit block key
+SEQ []
+MAP {}
=VAL :implicit flow key
=VAL :value
-MAP
-SEQ
-MAP
-DOC
-STR
{
"implicit block key": [
{
"implicit flow key": "value"
}
]
}
{
"implicit block key": [
{
"implicit flow key": "value"
}
]
}
- !!str "a" - 'b' - &anchor "c" - *anchor - !!str
+STR +DOC +SEQ =VAL <tag:yaml.org,2002:str> "a =VAL 'b =VAL &anchor "c =ALI *anchor =VAL <tag:yaml.org,2002:str> : -SEQ -DOC -STR
[ "a", "b", "c", "c", "" ]
[ "a", "b", "c", "c", "" ]
---
!invalid{}tag scalar
Yamlrw error: invalid tag: expected whitespace or line break after tag at line 2, columns 1-1
- [a, b , c ]
- { "a" : b
, c : 'd' ,
e : "f"
}
- [ ]
+STR
+DOC
+SEQ
+SEQ []
=VAL :a
=VAL :b
=VAL :c
-SEQ
+MAP {}
=VAL "a
=VAL :b
=VAL :c
=VAL 'd
=VAL :e
=VAL "f
-MAP
+SEQ []
-SEQ
-SEQ
-DOC
-STR
[
[
"a",
"b",
"c"
],
{
"a": "b",
"c": "d",
"e": "f"
},
[]
]
[
[
"a",
"b",
"c"
],
{
"a": "b",
"c": "d",
"e": "f"
},
[]
]
"implicit block key" : [ "implicit flow key" : value, ]
+STR
+DOC
+MAP
=VAL "implicit block key
+SEQ []
+MAP {}
=VAL "implicit flow key
=VAL :value
-MAP
-SEQ
-MAP
-DOC
-STR
{
"implicit block key": [
{
"implicit flow key": "value"
}
]
}
{
"implicit block key": [
{
"implicit flow key": "value"
}
]
}
[flow]: block
+STR +DOC +MAP +SEQ [] =VAL :flow -SEQ =VAL :block -MAP -DOC -STR
a: | ab cd ef ...
+STR +DOC +MAP =VAL :a =VAL |ab\n\ncd\nef\n -MAP -DOC ... -STR
{
"a": "ab\n\ncd\nef\n"
}
{
"a": "ab\n\ncd\nef\n"
}
- ? : x
+STR +DOC +SEQ +MAP +MAP =VAL : =VAL :x -MAP =VAL : -MAP -SEQ -DOC -STR
? []: x
+STR +DOC +MAP +MAP +SEQ [] -SEQ =VAL :x -MAP =VAL : -MAP -DOC -STR
literal: |2 value folded: !foo >1 value
+STR +DOC +MAP =VAL :literal =VAL |value\n =VAL :folded =VAL <!foo> >value\n -MAP -DOC -STR
{
"literal": "value\n",
"folded": "value\n"
}
{
"literal": "value\n",
"folded": "value\n"
}
? - Detroit Tigers
- Chicago cubs
:
- 2001-07-23
? [ New York Yankees,
Atlanta Braves ]
: [ 2001-07-02, 2001-08-12,
2001-08-14 ]
+STR +DOC +MAP +SEQ =VAL :Detroit Tigers =VAL :Chicago cubs -SEQ +SEQ =VAL :2001-07-23 -SEQ +SEQ [] =VAL :New York Yankees =VAL :Atlanta Braves -SEQ +SEQ [] =VAL :2001-07-02 =VAL :2001-08-12 =VAL :2001-08-14 -SEQ -MAP -DOC -STR
- | x - foo: bar - - 42
+STR +DOC +SEQ =VAL |x\n +MAP =VAL :foo =VAL :bar -MAP +SEQ =VAL :42 -SEQ -SEQ -DOC -STR
[
"x\n",
{
"foo" : "bar"
},
[
42
]
]
[
"x\n",
{
"foo": "bar"
},
[
42
]
]
Bare document ... # No document ... | %!PS-Adobe-2.0 # Not the first line
+STR +DOC =VAL :Bare document -DOC ... +DOC =VAL |%!PS-Adobe-2.0 # Not the first line\n -DOC -STR
"Bare document" "%!PS-Adobe-2.0 # Not the first line\n"
"Bare document" "%!PS-Adobe-2.0 # Not the first line\n"
---
{
a: [
b, c, {
d: [e, f]
}
]
}
+STR
+DOC ---
+MAP {}
=VAL :a
+SEQ []
=VAL :b
=VAL :c
+MAP {}
=VAL :d
+SEQ []
=VAL :e
=VAL :f
-SEQ
-MAP
-SEQ
-MAP
-DOC
-STR
{
"a": [
"b",
"c",
{
"d": [
"e",
"f"
]
}
]
}
{
"a": [
"b",
"c",
{
"d": [
"e",
"f"
]
}
]
}
| literal text
+STR +DOC =VAL |literal\n\ttext\n -DOC -STR
"literal\n\ttext\n"
"literal\n\ttext\n"
> foo bar baz
+STR +DOC =VAL >foo \n\n\t bar\n\nbaz\n -DOC -STR
"foo \n\n\t bar\n\nbaz\n"
"foo \n\n\t bar\n\nbaz\n"
%YAML 1.1#... ---
Yamlrw error: comments must be separated from other tokens by whitespace at line 1, columns 10-10
%YAML 1.2 --- %YAML 1.2 ---
Yamlrw error: invalid directive: directives require explicit document end '...' before them at line 3, columns 1-10
%YAML 1.1 ---
+STR +DOC --- =VAL : -DOC -STR
null
null
%YAML 1.1 ---
+STR +DOC --- =VAL : -DOC -STR
null
null
%YAML 1.1 # comment ---
+STR +DOC --- =VAL : -DOC -STR
null
null
%YAM 1.1 ---
+STR +DOC --- =VAL : -DOC -STR
null
null
%YAMLL 1.1 ---
+STR +DOC --- =VAL : -DOC -STR
null
null
- {a: b}
+STR
+DOC
+SEQ
+MAP {}
=VAL :a
=VAL :b
-MAP
-SEQ
-DOC
-STR
[
{
"a": "b"
}
]
[
{
"a": "b"
}
]
|- ab ...
+STR +DOC =VAL |ab -DOC ... -STR
"ab"
"ab"
- plain - "double quoted" - 'single quoted' - > block - plain again
+STR +DOC +SEQ =VAL :plain =VAL "double quoted =VAL 'single quoted =VAL >block\n =VAL :plain again -SEQ -DOC -STR
[ "plain", "double quoted", "single quoted", "block\n", "plain again" ]
[ "plain", "double quoted", "single quoted", "block\n", "plain again" ]
map: key1: "quoted1" key2: "bad indentation"
Yamlrw error: expected mapping key at line 3, columns 2-2
[ --- , ... ]
Yamlrw error: expected sequence end ']' at line 2, columns 1-4
--- a: ' ' b: ' ' c: " " d: " " e: ' ' f: " " g: ' ' h: " "
+STR +DOC --- +MAP =VAL :a =VAL ' =VAL :b =VAL ' =VAL :c =VAL " =VAL :d =VAL " =VAL :e =VAL '\n =VAL :f =VAL "\n =VAL :g =VAL '\n\n =VAL :h =VAL "\n\n -MAP -DOC -STR
{
"a": " ",
"b": " ",
"c": " ",
"d": " ",
"e": "\n",
"f": "\n",
"g": "\n\n",
"h": "\n\n"
}
{
"a": " ",
"b": " ",
"c": " ",
"d": " ",
"e": "\n",
"f": "\n",
"g": "\n\n",
"h": "\n\n"
}
key: value with tabs
+STR +DOC +MAP =VAL :key =VAL :value with\ntabs -MAP -DOC -STR
{
"key": "value with\ntabs"
}
{
"key": "value with\ntabs"
}
:
+STR +DOC +MAP =VAL : =VAL : -MAP -DOC -STR
---
- { single line: value}
- { multi
line: value}
+STR
+DOC ---
+SEQ
+MAP {}
=VAL :single line
=VAL :value
-MAP
+MAP {}
=VAL :multi line
=VAL :value
-MAP
-SEQ
-DOC
-STR
[
{
"single line": "value"
},
{
"multi line": "value"
}
]
[
{
"single line": "value"
},
{
"multi line": "value"
}
]
---
key: value
: empty key
---
{
key: value, : empty key
}
---
# empty key and value
:
---
# empty key and value
{ : }
+STR
+DOC ---
+MAP
=VAL :key
=VAL :value
=VAL :
=VAL :empty key
-MAP
-DOC
+DOC ---
+MAP {}
=VAL :key
=VAL :value
=VAL :
=VAL :empty key
-MAP
-DOC
+DOC ---
+MAP
=VAL :
=VAL :
-MAP
-DOC
+DOC ---
+MAP {}
=VAL :
=VAL :
-MAP
-DOC
-STR
"folded to a space, to a line feed, or \ \ non-content"
+STR +DOC =VAL "folded to a space,\nto a line feed, or \t \tnon-content -DOC -STR
"folded to a space,\nto a line feed, or \t \tnon-content"
"folded to a space,\nto a line feed, or \t \tnon-content"
- | # Empty header↓ literal - >1 # Indentation indicator↓ folded - |+ # Chomping indicator↓ keep - >1- # Both indicators↓ strip
+STR +DOC +SEQ =VAL |literal\n =VAL > folded\n =VAL |keep\n\n =VAL > strip -SEQ -DOC -STR
[ "literal\n", " folded\n", "keep\n\n", " strip" ]
[ "literal\n", " folded\n", "keep\n\n", " strip" ]
---
- { y: z }- invalid
Yamlrw error: block sequence entries are not allowed in this context at line 2, columns 11-11
%TAG !! tag:example.com,2000:app/ --- !!int 1 - 3 # Interval, not integer
+STR +DOC --- =VAL <tag:example.com,2000:app/int> :1 - 3 -DOC -STR
"1 - 3"
"1 - 3"
key: # Comment
# lines
value
+STR +DOC +MAP =VAL :key =VAL :value -MAP -DOC -STR
{
"key": "value"
}
{
"key": "value"
}
american: - Boston Red Sox - Detroit Tigers - New York Yankees national: - New York Mets - Chicago Cubs - Atlanta Braves
+STR +DOC +MAP =VAL :american +SEQ =VAL :Boston Red Sox =VAL :Detroit Tigers =VAL :New York Yankees -SEQ =VAL :national +SEQ =VAL :New York Mets =VAL :Chicago Cubs =VAL :Atlanta Braves -SEQ -MAP -DOC -STR
{
"american": [
"Boston Red Sox",
"Detroit Tigers",
"New York Yankees"
],
"national": [
"New York Mets",
"Chicago Cubs",
"Atlanta Braves"
]
}
{
"american": [
"Boston Red Sox",
"Detroit Tigers",
"New York Yankees"
],
"national": [
"New York Mets",
"Chicago Cubs",
"Atlanta Braves"
]
}
' 1st non-empty 2nd non-empty 3rd non-empty '
+STR +DOC =VAL ' 1st non-empty\n2nd non-empty 3rd non-empty -DOC -STR
" 1st non-empty\n2nd non-empty 3rd non-empty "
" 1st non-empty\n2nd non-empty 3rd non-empty "
--- a: b ---
+STR +DOC --- +MAP =VAL :a =VAL :b -MAP -DOC +DOC --- =VAL : -DOC -STR
{
"a": "b"
}
null
{
"a": "b"
}
null
- &a - a - &a : a b: &b - &c : &a - ? &d - ? &e : &a
+STR +DOC +SEQ =VAL &a : =VAL :a +MAP =VAL &a : =VAL :a =VAL :b =VAL &b : -MAP +MAP =VAL &c : =VAL &a : -MAP +MAP =VAL &d : =VAL : -MAP +MAP =VAL &e : =VAL &a : -MAP -SEQ -DOC -STR
key1: "quoted1" key2: "quoted2" trailing content key3: "quoted3"
Yamlrw error: expected mapping key at lines 2-3
{}
+STR
+DOC
+MAP {}
-MAP
-DOC
-STR
{}
{}
- [ a, b ]
- { a: b }
- "a"
- 'b'
- c
+STR
+DOC
+SEQ
+SEQ []
=VAL :a
=VAL :b
-SEQ
+MAP {}
=VAL :a
=VAL :b
-MAP
=VAL "a
=VAL 'b
=VAL :c
-SEQ
-DOC
-STR
[
[
"a",
"b"
],
{
"a": "b"
},
"a",
"b",
"c"
]
[
[
"a",
"b"
],
{
"a": "b"
},
"a",
"b",
"c"
]
--- "folded to a space, to a line feed, or \ \ non-content"
+STR +DOC --- =VAL "folded to a space,\nto a line feed, or \t \tnon-content -DOC -STR
"folded to a space,\nto a line feed, or \t \tnon-content"
"folded to a space,\nto a line feed, or \t \tnon-content"
{ first: Sammy, last: Sosa }:
# Statistics:
hr: # Home runs
65
avg: # Average
0.278
+STR
+DOC
+MAP
+MAP {}
=VAL :first
=VAL :Sammy
=VAL :last
=VAL :Sosa
-MAP
+MAP
=VAL :hr
=VAL :65
=VAL :avg
=VAL :0.278
-MAP
-MAP
-DOC
-STR
--- quoted: "a b c"
Yamlrw error: invalid indentation in quoted scalar at line 3, columns 1-1
[ foo: bar ]
+STR
+DOC
+SEQ []
+MAP {}
=VAL :foo
=VAL :bar
-MAP
-SEQ
-DOC
-STR
[
{
"foo": "bar"
}
]
[
{
"foo": "bar"
}
]
%TAG !prefix! tag:example.com,2011: --- !prefix!A a: b --- !prefix!B c: d --- !prefix!C e: f
Yamlrw error: invalid tag: !prefix!B
# comment ...
+STR -STR
- | detected - > # detected - |1 explicit - > detected
+STR +DOC +SEQ =VAL |detected\n =VAL >\n\n# detected\n =VAL | explicit\n =VAL >\t\ndetected\n -SEQ -DOC -STR
[ "detected\n", "\n\n# detected\n", " explicit\n", "\t\ndetected\n" ]
[ "detected\n", "\n\n# detected\n", " explicit\n", "\t\ndetected\n" ]
---
{ top1: [item1, {key2: value2}, item3], top2: value2 }
+STR
+DOC ---
+MAP {}
=VAL :top1
+SEQ []
=VAL :item1
+MAP {}
=VAL :key2
=VAL :value2
-MAP
=VAL :item3
-SEQ
=VAL :top2
=VAL :value2
-MAP
-DOC
-STR
{
"top1": [
"item1",
{
"key2": "value2"
},
"item3"
],
"top2": "value2"
}
{
"top1": [
"item1",
{
"key2": "value2"
},
"item3"
],
"top2": "value2"
}
--- key: value %YAML 1.2 ---
Yamlrw error: unexpected token: directives must be separated from document content by document end marker (...) at line 3, columns 1-1
foo: - 42 bar: - 44
+STR +DOC +MAP =VAL :foo +SEQ =VAL :42 -SEQ =VAL :bar +SEQ =VAL :44 -SEQ -MAP -DOC -STR
{
"foo": [
42
],
"bar": [
44
]
}
{
"foo": [
42
],
"bar": [
44
]
}
a: 4.2 ? d : 23
+STR +DOC +MAP =VAL :a =VAL :4.2 =VAL :d =VAL :23 -MAP -DOC -STR
{
"d": 23,
"a": 4.2
}
{
"a": 4.2,
"d": 23
}
%YAML 1.2 --- Document ... # Suffix
+STR +DOC --- =VAL :Document -DOC ... -STR
"Document"
"Document"
--- ' ... '
Yamlrw error: unclosed single quote at line 2, columns 1-1
a: "double quotes" # lala b: plain value # lala c : #lala d ? # lala - seq1 : # lala - #lala seq2 e: &node # lala - x: y block: > # lala abcde
+STR +DOC +MAP =VAL :a =VAL "double quotes =VAL :b =VAL :plain value =VAL :c =VAL :d +SEQ =VAL :seq1 -SEQ +SEQ =VAL :seq2 -SEQ =VAL :e +SEQ &node +MAP =VAL :x =VAL :y -MAP -SEQ =VAL :block =VAL >abcde\n -MAP -DOC -STR
---
Time: 2001-11-23 15:01:42 -5
User: ed
Warning:
This is an error message
for the log file
---
Time: 2001-11-23 15:02:31 -5
User: ed
Warning:
A slightly different error
message.
---
Date: 2001-11-23 15:03:17 -5
User: ed
Fatal:
Unknown variable "bar"
Stack:
- file: TopClass.py
line: 23
code: |
x = MoreObject("345\n")
- file: MoreClass.py
line: 58
code: |-
foo = bar
+STR
+DOC ---
+MAP
=VAL :Time
=VAL :2001-11-23 15:01:42 -5
=VAL :User
=VAL :ed
=VAL :Warning
=VAL :This is an error message for the log file
-MAP
-DOC
+DOC ---
+MAP
=VAL :Time
=VAL :2001-11-23 15:02:31 -5
=VAL :User
=VAL :ed
=VAL :Warning
=VAL :A slightly different error message.
-MAP
-DOC
+DOC ---
+MAP
=VAL :Date
=VAL :2001-11-23 15:03:17 -5
=VAL :User
=VAL :ed
=VAL :Fatal
=VAL :Unknown variable "bar"
=VAL :Stack
+SEQ
+MAP
=VAL :file
=VAL :TopClass.py
=VAL :line
=VAL :23
=VAL :code
=VAL |x = MoreObject("345\\n")\n
-MAP
+MAP
=VAL :file
=VAL :MoreClass.py
=VAL :line
=VAL :58
=VAL :code
=VAL |foo = bar
-MAP
-SEQ
-MAP
-DOC
-STR
{
"Time": "2001-11-23 15:01:42 -5",
"User": "ed",
"Warning": "This is an error message for the log file"
}
{
"Time": "2001-11-23 15:02:31 -5",
"User": "ed",
"Warning": "A slightly different error message."
}
{
"Date": "2001-11-23 15:03:17 -5",
"User": "ed",
"Fatal": "Unknown variable \"bar\"",
"Stack": [
{
"file": "TopClass.py",
"line": 23,
"code": "x = MoreObject(\"345\\n\")\n"
},
{
"file": "MoreClass.py",
"line": 58,
"code": "foo = bar"
}
]
}
{
"Time": "2001-11-23 15:01:42 -5",
"User": "ed",
"Warning": "This is an error message for the log file"
}
{
"Time": "2001-11-23 15:02:31 -5",
"User": "ed",
"Warning": "A slightly different error message."
}
{
"Date": "2001-11-23 15:03:17 -5",
"User": "ed",
"Fatal": "Unknown variable \"bar\"",
"Stack": [
{
"file": "TopClass.py",
"line": 23,
"code": "x = MoreObject(\"345\\n\")\n"
},
{
"file": "MoreClass.py",
"line": 58,
"code": "foo = bar"
}
]
}
plain key: in-line value : # Both empty "quoted key": - entry
+STR +DOC +MAP =VAL :plain key =VAL :in-line value =VAL : =VAL : =VAL "quoted key +SEQ =VAL :entry -SEQ -MAP -DOC -STR
--- folded: > first line second line
Yamlrw error: invalid block scalar header: expected newline after header at line 2, columns 11-11
# Assuming conventional resolution: - "12" - 12 - ! 12
+STR +DOC +SEQ =VAL "12 =VAL :12 =VAL <!> :12 -SEQ -DOC -STR
[ "12", 12, "12" ]
[ "12", 12, "12" ]
aaa: bbb ...
+STR +DOC +MAP =VAL :aaa =VAL :bbb -MAP -DOC ... -STR
{
"aaa": "bbb"
}
{
"aaa": "bbb"
}
--- - :,
+STR +DOC --- +SEQ =VAL ::, -SEQ -DOC -STR
[ ":," ]
[ ":," ]
empty block scalar: > # comment
Yamlrw error: invalid block scalar header: wrongly indented line in block scalar at line 5, columns 2-2
sequence: - one - two mapping: ? sky : blue sea : green
+STR +DOC +MAP =VAL :sequence +SEQ =VAL :one =VAL :two -SEQ =VAL :mapping +MAP =VAL :sky =VAL :blue =VAL :sea =VAL :green -MAP -MAP -DOC -STR
{
"sequence": [
"one",
"two"
],
"mapping": {
"sky": "blue",
"sea": "green"
}
}
{
"sequence": [
"one",
"two"
],
"mapping": {
"sky": "blue",
"sea": "green"
}
}
{a: [b, c], [d, e]: f}
+STR
+DOC
+MAP {}
=VAL :a
+SEQ []
=VAL :b
=VAL :c
-SEQ
+SEQ []
=VAL :d
=VAL :e
-SEQ
=VAL :f
-MAP
-DOC
-STR
%YAML 1.2 %YAML 1.2 ---
Yamlrw error: invalid YAML version: duplicate YAML directive at line 2, columns 1-10
--- seq: &anchor - a - b
+STR +DOC --- +MAP =VAL :seq +SEQ &anchor =VAL :a =VAL :b -SEQ -MAP -DOC -STR
{
"seq": [
"a",
"b"
]
}
{
"seq": [
"a",
"b"
]
}
-
+STR +DOC +SEQ =VAL : -SEQ -DOC -STR
[null]
[ null ]
:
+STR +DOC +MAP =VAL : =VAL : -MAP -DOC -STR
key1: &a value key2: &b *a
Yamlrw error: expected mapping key at line 2, columns 10-12
--- 'here''s to "quotes"'
+STR +DOC --- =VAL 'here's to "quotes" -DOC -STR
"here's to \"quotes\""
"here's to \"quotes\""
key: "value"# invalid comment
Yamlrw error: comments must be separated from other tokens by whitespace at line 1, columns 13-13
key1: &alias value1 &b *alias : value2
Yamlrw error: expected mapping key at line 2, columns 4-10
&anchor - sequence entry
Yamlrw error: block sequence entries are not allowed in this context at line 1, columns 9-9
hr: 65 # Home runs avg: 0.278 # Batting average rbi: 147 # Runs Batted In
+STR +DOC +MAP =VAL :hr =VAL :65 =VAL :avg =VAL :0.278 =VAL :rbi =VAL :147 -MAP -DOC -STR
{
"hr": 65,
"avg": 0.278,
"rbi": 147
}
{
"hr": 65,
"avg": 0.278,
"rbi": 147
}
--- | literal text # Comment
+STR +DOC --- =VAL |\n\nliteral\n \n\ntext\n -DOC -STR
"\n\nliteral\n \n\ntext\n"
"\n\nliteral\n \n\ntext\n"
--- ' 1st non-empty 2nd non-empty 3rd non-empty '
+STR +DOC --- =VAL ' 1st non-empty\n2nd non-empty 3rd non-empty -DOC -STR
" 1st non-empty\n2nd non-empty 3rd non-empty "
" 1st non-empty\n2nd non-empty 3rd non-empty "
--- | literal text
+STR +DOC --- =VAL |literal\n\ttext\n -DOC -STR
"literal\n\ttext\n"
"literal\n\ttext\n"
---
{
foo: 1
bar: 2 }
Yamlrw error: expected mapping end '}' at line 4, columns 5-7
- item1 - item2 invalid
Yamlrw error: expected mapping key at line 3, columns 1-1
block mapping: key: value
+STR +DOC +MAP =VAL :block mapping +MAP =VAL :key =VAL :value -MAP -MAP -DOC -STR
{
"block mapping": {
"key": "value"
}
}
{
"block mapping": {
"key": "value"
}
}
" foo bar baz "
+STR +DOC =VAL " foo\nbar\nbaz -DOC -STR
" foo\nbar\nbaz "
" foo\nbar\nbaz "
> ab cd ef gh
+STR +DOC =VAL >ab cd\nef\n\ngh\n -DOC -STR
"ab cd\nef\n\ngh\n"
"ab cd\nef\n\ngh\n"
%TAG !yaml! tag:yaml.org,2002: --- !yaml!str "foo"
+STR +DOC --- =VAL <tag:yaml.org,2002:str> "foo -DOC -STR
"foo"
"foo"
--- top1: &node1 &k1 key1: one top2: &node2 # comment key2: two top3: &k3 key3: three top4: &node4 &k4 key4: four top5: &node5 key5: five top6: &val6 six top7: &val7 seven
+STR +DOC --- +MAP =VAL :top1 +MAP &node1 =VAL &k1 :key1 =VAL :one -MAP =VAL :top2 +MAP &node2 =VAL :key2 =VAL :two -MAP =VAL :top3 +MAP =VAL &k3 :key3 =VAL :three -MAP =VAL :top4 +MAP &node4 =VAL &k4 :key4 =VAL :four -MAP =VAL :top5 +MAP &node5 =VAL :key5 =VAL :five -MAP =VAL :top6 =VAL &val6 :six =VAL :top7 =VAL &val7 :seven -MAP -DOC -STR
{
"top1": {
"key1": "one"
},
"top2": {
"key2": "two"
},
"top3": {
"key3": "three"
},
"top4": {
"key4": "four"
},
"top5": {
"key5": "five"
},
"top6": "six",
"top7": "seven"
}
{
"top1": {
"key1": "one"
},
"top2": {
"key2": "two"
},
"top3": {
"key3": "three"
},
"top4": {
"key4": "four"
},
"top5": {
"key5": "five"
},
"top6": "six",
"top7": "seven"
}
map: key1: "quoted1" key2: "bad indentation"
Yamlrw error: expected mapping key at line 3, columns 4-4
- !!str, xxx
Yamlrw error: invalid tag: expected whitespace or line break after tag at line 1, columns 3-3
--- time: 20:03:20 player: Sammy Sosa action: strike (miss) ... --- time: 20:03:47 player: Sammy Sosa action: grand slam ...
+STR +DOC --- +MAP =VAL :time =VAL :20:03:20 =VAL :player =VAL :Sammy Sosa =VAL :action =VAL :strike (miss) -MAP -DOC ... +DOC --- +MAP =VAL :time =VAL :20:03:47 =VAL :player =VAL :Sammy Sosa =VAL :action =VAL :grand slam -MAP -DOC ... -STR
{
"time": "20:03:20",
"player": "Sammy Sosa",
"action": "strike (miss)"
}
{
"time": "20:03:47",
"player": "Sammy Sosa",
"action": "grand slam"
}
{
"time": "20:03:20",
"player": "Sammy Sosa",
"action": "strike (miss)"
}
{
"time": "20:03:47",
"player": "Sammy Sosa",
"action": "grand slam"
}
- { url: http://example.org }
+STR
+DOC
+SEQ
+MAP {}
=VAL :url
=VAL :http://example.org
-MAP
-SEQ
-DOC
-STR
[
{
"url": "http://example.org"
}
]
[
{
"url": "http://example.org"
}
]
sequence: [ one, two, ]
mapping: { sky: blue, sea: green }
+STR
+DOC
+MAP
=VAL :sequence
+SEQ []
=VAL :one
=VAL :two
-SEQ
=VAL :mapping
+MAP {}
=VAL :sky
=VAL :blue
=VAL :sea
=VAL :green
-MAP
-MAP
-DOC
-STR
{
"sequence": [
"one",
"two"
],
"mapping": {
"sky": "blue",
"sea": "green"
}
}
{
"sequence": [
"one",
"two"
],
"mapping": {
"sky": "blue",
"sea": "green"
}
}
--- !<tag:clarkevans.com,2002:invoice>
invoice: 34843
date : 2001-01-23
bill-to: &id001
given : Chris
family : Dumars
address:
lines: |
458 Walkman Dr.
Suite #292
city : Royal Oak
state : MI
postal : 48046
ship-to: *id001
product:
- sku : BL394D
quantity : 4
description : Basketball
price : 450.00
- sku : BL4438H
quantity : 1
description : Super Hoop
price : 2392.00
tax : 251.42
total: 4443.52
comments:
Late afternoon is best.
Backup contact is Nancy
Billsmer @ 338-4338.
+STR +DOC --- +MAP <tag:clarkevans.com,2002:invoice> =VAL :invoice =VAL :34843 =VAL :date =VAL :2001-01-23 =VAL :bill-to +MAP &id001 =VAL :given =VAL :Chris =VAL :family =VAL :Dumars =VAL :address +MAP =VAL :lines =VAL |458 Walkman Dr.\nSuite #292\n =VAL :city =VAL :Royal Oak =VAL :state =VAL :MI =VAL :postal =VAL :48046 -MAP -MAP =VAL :ship-to =ALI *id001 =VAL :product +SEQ +MAP =VAL :sku =VAL :BL394D =VAL :quantity =VAL :4 =VAL :description =VAL :Basketball =VAL :price =VAL :450.00 -MAP +MAP =VAL :sku =VAL :BL4438H =VAL :quantity =VAL :1 =VAL :description =VAL :Super Hoop =VAL :price =VAL :2392.00 -MAP -SEQ =VAL :tax =VAL :251.42 =VAL :total =VAL :4443.52 =VAL :comments =VAL :Late afternoon is best. Backup contact is Nancy Billsmer @ 338-4338. -MAP -DOC -STR
{
"invoice": 34843,
"date": "2001-01-23",
"bill-to": {
"given": "Chris",
"family": "Dumars",
"address": {
"lines": "458 Walkman Dr.\nSuite #292\n",
"city": "Royal Oak",
"state": "MI",
"postal": 48046
}
},
"ship-to": {
"given": "Chris",
"family": "Dumars",
"address": {
"lines": "458 Walkman Dr.\nSuite #292\n",
"city": "Royal Oak",
"state": "MI",
"postal": 48046
}
},
"product": [
{
"sku": "BL394D",
"quantity": 4,
"description": "Basketball",
"price": 450
},
{
"sku": "BL4438H",
"quantity": 1,
"description": "Super Hoop",
"price": 2392
}
],
"tax": 251.42,
"total": 4443.52,
"comments": "Late afternoon is best. Backup contact is Nancy Billsmer @ 338-4338."
}
{
"invoice": 34843,
"date": "2001-01-23",
"bill-to": {
"given": "Chris",
"family": "Dumars",
"address": {
"lines": "458 Walkman Dr.\nSuite #292\n",
"city": "Royal Oak",
"state": "MI",
"postal": 48046
}
},
"ship-to": {
"given": "Chris",
"family": "Dumars",
"address": {
"lines": "458 Walkman Dr.\nSuite #292\n",
"city": "Royal Oak",
"state": "MI",
"postal": 48046
}
},
"product": [
{
"sku": "BL394D",
"quantity": 4,
"description": "Basketball",
"price": 450
},
{
"sku": "BL4438H",
"quantity": 1,
"description": "Super Hoop",
"price": 2392
}
],
"tax": 251.42,
"total": 4443.52,
"comments": "Late afternoon is best. Backup contact is Nancy Billsmer @ 338-4338."
}
- :
+STR +DOC +SEQ +MAP =VAL : =VAL : -MAP -SEQ -DOC -STR
::
+STR +DOC +MAP =VAL :: =VAL : -MAP -DOC -STR
{
":": null
}
{
":": null
}
!
+STR +DOC =VAL <!> : -DOC -STR
---
{ matches
% : 20 }
...
---
# Empty
...
+STR
+DOC ---
+MAP {}
=VAL :matches %
=VAL :20
-MAP
-DOC ...
+DOC ---
=VAL :
-DOC ...
-STR
{
"matches %": 20
}
null
{
"matches %": 20
}
null
x: - x x
+STR +DOC +MAP =VAL :x +SEQ =VAL :x x -SEQ -MAP -DOC -STR
{
"x": [
"x x"
]
}
{
"x": [
"x x"
]
}
- &a a - &b b - *a - *b
+STR +DOC +SEQ =VAL &a :a =VAL &b :b =ALI *a =ALI *b -SEQ -DOC -STR
[ "a", "b", "a", "b" ]
[ "a", "b", "a", "b" ]
- sun: yellow - ? earth: blue : moon: white
+STR +DOC +SEQ +MAP =VAL :sun =VAL :yellow -MAP +MAP +MAP =VAL :earth =VAL :blue -MAP +MAP =VAL :moon =VAL :white -MAP -MAP -SEQ -DOC -STR
k: {
k
:
v
}
Yamlrw error: invalid indentation in flow construct at line 2, columns 1-1
k: {
k
:
v
}
+STR
+DOC
+MAP
=VAL :k
+MAP {}
=VAL :k
=VAL :v
-MAP
-MAP
-DOC
-STR
{
"k" : {
"k" : "v"
}
}
{
"k": {
"k": "v"
}
}
- # Empty - | block node - - one # Compact - two # sequence - one: two # Compact mapping
+STR +DOC +SEQ =VAL : =VAL |block node\n +SEQ =VAL :one =VAL :two -SEQ +MAP =VAL :one =VAL :two -MAP -SEQ -DOC -STR
[
null,
"block node\n",
[
"one",
"two"
],
{
"one": "two"
}
]
[
null,
"block node\n",
[
"one",
"two"
],
{
"one": "two"
}
]
%YAML 1.2 --- | %!PS-Adobe-2.0 ... %YAML 1.2 --- # Empty ...
+STR +DOC --- =VAL |%!PS-Adobe-2.0\n -DOC ... +DOC --- =VAL : -DOC ... -STR
"%!PS-Adobe-2.0\n" null
"%!PS-Adobe-2.0\n" null
a: &:@*!$"<foo>: scalar a b: *:@*!$"<foo>:
+STR +DOC +MAP =VAL :a =VAL &:@*!$"<foo>: :scalar a =VAL :b =ALI *:@*!$"<foo>: -MAP -DOC -STR
{
"a": "scalar a",
"b": "scalar a"
}
{
"a": "scalar a",
"b": "scalar a"
}
---
block scalar: |
more spaces at the beginning
are invalid
Yamlrw error: invalid block scalar header: wrongly indented line in block scalar at line 4, columns 3-3
{
foo : !!str,
!!str : bar,
}
+STR
+DOC
+MAP {}
=VAL :foo
=VAL <tag:yaml.org,2002:str> :
=VAL <tag:yaml.org,2002:str> :
=VAL :bar
-MAP
-DOC
-STR
{
"foo": "",
"": "bar"
}
{
"foo": "",
"": "bar"
}
{ &a [a, &b b]: *b, *a : [c, *b, d]}
+STR
+DOC
+MAP {}
+SEQ [] &a
=VAL :a
=VAL &b :b
-SEQ
=ALI *b
=ALI *a
+SEQ []
=VAL :c
=ALI *b
=VAL :d
-SEQ
-MAP
-DOC
-STR
block: ># comment scalar
Yamlrw error: comments must be separated from other tokens by whitespace at line 1, columns 9-9
--- ? key # comment : value
+STR +DOC --- +MAP =VAL :key =VAL :value -MAP -DOC -STR
{
"key": "value"
}
{
"key": "value"
}
--- scalar %YAML 1.2
+STR +DOC --- =VAL :scalar %YAML 1.2 -DOC -STR
"scalar %YAML 1.2"
"scalar %YAML 1.2"
Folding: "Empty line as a line feed" Chomping: | Clipped empty lines
+STR +DOC +MAP =VAL :Folding =VAL "Empty line\nas a line feed =VAL :Chomping =VAL |Clipped empty lines\n -MAP -DOC -STR
{
"Folding": "Empty line\nas a line feed",
"Chomping": "Clipped empty lines\n"
}
{
"Folding": "Empty line\nas a line feed",
"Chomping": "Clipped empty lines\n"
}
a: "double quotes" # lala b: plain value # lala c : #lala d ? # lala - seq1 : # lala - #lala seq2 e: &node # lala - x: y block: > # lala abcde
+STR +DOC +MAP =VAL :a =VAL "double quotes =VAL :b =VAL :plain value =VAL :c =VAL :d +SEQ =VAL :seq1 -SEQ +SEQ =VAL :seq2 -SEQ =VAL :e +SEQ &node +MAP =VAL :x =VAL :y -MAP -SEQ =VAL :block =VAL >abcde\n -MAP -DOC -STR
--- key: &an:chor value
+STR +DOC --- +MAP =VAL :key =VAL &an:chor :value -MAP -DOC -STR
{
"key": "value"
}
{
"key": "value"
}
foo: | bar: 1
Yamlrw error: tab character in indentation at line 2, columns 1-1
foo: | bar: 1
+STR +DOC +MAP =VAL :foo =VAL |\t\n =VAL :bar =VAL :1 -MAP -DOC -STR
{
"foo": "\t\n",
"bar": 1
}
{
"foo": "\t\n",
"bar": 1
}
- [ foo ]
+STR +DOC +SEQ +SEQ [] =VAL :foo -SEQ -SEQ -DOC -STR
[
[
"foo"
]
]
[
[
"foo"
]
]
- [ foo, foo ]
Yamlrw error: invalid indentation in flow construct at line 2, columns 1-1
- -
Yamlrw error: tab character in indentation at line 1, columns 1-1
- -
Yamlrw error: tab character in indentation at line 1, columns 1-1
? -
Yamlrw error: tab character in indentation at line 1, columns 1-1
? - : -
Yamlrw error: tab character in indentation at line 2, columns 1-1
? key:
Yamlrw error: tab character in indentation at line 1, columns 1-1
? key: : key:
Yamlrw error: tab character in indentation at line 2, columns 1-1
- -1
+STR +DOC +SEQ =VAL :-1 -SEQ -DOC -STR
[ -1 ]
[ -1 ]
- [name , hr, avg ] - [Mark McGwire, 65, 0.278] - [Sammy Sosa , 63, 0.288]
+STR +DOC +SEQ +SEQ [] =VAL :name =VAL :hr =VAL :avg -SEQ +SEQ [] =VAL :Mark McGwire =VAL :65 =VAL :0.278 -SEQ +SEQ [] =VAL :Sammy Sosa =VAL :63 =VAL :0.288 -SEQ -SEQ -DOC -STR
[
[
"name",
"hr",
"avg"
],
[
"Mark McGwire",
65,
0.278
],
[
"Sammy Sosa",
63,
0.288
]
]
[
[
"name",
"hr",
"avg"
],
[
"Mark McGwire",
65,
0.278
],
[
"Sammy Sosa",
63,
0.288
]
]
[-]
Yamlrw error: unexpected character '-' at line 1, columns 2-2
literal: |2 value folded: !foo >1 value
+STR +DOC +MAP =VAL :literal =VAL |value\n =VAL :folded =VAL <!foo> >value\n -MAP -DOC -STR
{
"literal": "value\n",
"folded": "value\n"
}
{
"literal": "value\n",
"folded": "value\n"
}
%TAG !e! tag:example.com,2000:app/ --- - !e!foo "bar"
+STR +DOC --- +SEQ =VAL <tag:example.com,2000:app/foo> "bar -SEQ -DOC -STR
[ "bar" ]
[ "bar" ]
a: b: c: d
Yamlrw error: expected mapping key at line 1, columns 5-5
Mark McGwire: {hr: 65, avg: 0.278}
Sammy Sosa: {
hr: 63,
avg: 0.288
}
+STR
+DOC
+MAP
=VAL :Mark McGwire
+MAP {}
=VAL :hr
=VAL :65
=VAL :avg
=VAL :0.278
-MAP
=VAL :Sammy Sosa
+MAP {}
=VAL :hr
=VAL :63
=VAL :avg
=VAL :0.288
-MAP
-MAP
-DOC
-STR
{
"Mark McGwire": {
"hr": 65,
"avg": 0.278
},
"Sammy Sosa": {
"hr": 63,
"avg": 0.288
}
}
{
"Mark McGwire": {
"hr": 65,
"avg": 0.278
},
"Sammy Sosa": {
"hr": 63,
"avg": 0.288
}
}
&a a: b c: &d d
+STR +DOC +MAP =VAL &a :a =VAL :b =VAL :c =VAL &d :d -MAP -DOC -STR
{
"a": "b",
"c": "d"
}
{
"a": "b",
"c": "d"
}
{ key: [[[
value
]]]
}
+STR
+DOC
+MAP {}
=VAL :key
+SEQ []
+SEQ []
+SEQ []
=VAL :value
-SEQ
-SEQ
-SEQ
-MAP
-DOC
-STR
{
"key": [
[
[
"value"
]
]
]
}
{
"key": [
[
[
"value"
]
]
]
}
--- a: 'b': c
Yamlrw error: expected mapping key at line 2, columns 7-7
- key: value - item1
Yamlrw error: expected block entry '-' at line 2, columns 2-2
--- a: 1 ? b &anchor c: 3
+STR +DOC --- +MAP =VAL :a =VAL :1 =VAL :b =VAL : =VAL &anchor :c =VAL :3 -MAP -DOC -STR
{
"a": 1,
"b": null,
"c": 3
}
{
"a": 1,
"b": null,
"c": 3
}
[ "key" :value ]
Yamlrw error: key and ':' must be on the same line in flow context at line 2, columns 3-3