--- &test-J7PZ
Title: Spec Example 2.26. Ordered Mappings
Tags: [ mapping, spec, tag, unknown-tag ]
# 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
}
]
diff
Minimal Events:
+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
Transformed Events:
+STR
+DOC
+SEQ
+MAP
=VAL :Mark McGwire
=VAL :65
-MAP
+MAP
=VAL :Sammy Sosa
=VAL :63
-MAP
+MAP
=VAL :Ken Griffy
=VAL :58
-MAP
-SEQ
-DOC
-STR
Got Events:
+STR
+DOC
+SEQ
+MAP
=VAL :Mark McGwire
=VAL :65
-MAP
+MAP
=VAL :Sammy Sosa
=VAL :63
-MAP
+MAP
=VAL :Ken Griffy
=VAL :58
-MAP
-SEQ
-DOC
-STR
json_diff
[
[
"Mark McGwire",
65
],
[
"Sammy Sosa",
63
],
[
"Ken Griffy",
58
]
]
json_diff
{
"Ken Griffy": 58,
"Mark McGwire": 65,
"Sammy Sosa": 63
}
json_diff
{
"Ken Griffy": 58,
"Mark McGwire": 65,
"Sammy Sosa": 63
}
na
Line Col Char Byte Token|Content
1 0 0 0 +COMM|
1 0 0 0 =SYNX|#
1 1 1 1 =META|.The.!!omap.tag.is.one.of.the.optional.types
1 45 45 45 -COMM|
1 45 45 45 =EOL |\x0a
2 0 46 46 +COMM|
2 0 46 46 =SYNX|#
2 1 47 47 =META|.introduced.for.YAML.1.1..In.1.2,.it.is.not
2 44 90 90 -COMM|
2 44 90 90 =EOL |\x0a
3 0 91 91 +COMM|
3 0 91 91 =SYNX|#
3 1 92 92 =META|.part.of.the.standard.tags.and.should.not.be
3 45 136 136 -COMM|
3 45 136 136 =EOL |\x0a
4 0 137 137 +COMM|
4 0 137 137 =SYNX|#
4 1 138 138 =META|.enabled.by.default.
4 21 158 158 -COMM|
4 21 158 158 =EOL |\x0a
5 0 159 159 +COMM|
5 0 159 159 =SYNX|#
5 1 160 160 =META|.Ordered.maps.are.represented.as
5 33 192 192 -COMM|
5 33 192 192 =EOL |\x0a
6 0 193 193 +COMM|
6 0 193 193 =SYNX|#
6 1 194 194 =META|.A.sequence.of.mappings,.with
6 30 223 223 -COMM|
6 30 223 223 =EOL |\x0a
7 0 224 224 +COMM|
7 0 224 224 =SYNX|#
7 1 225 225 =META|.each.mapping.having.one.key
7 29 253 253 -COMM|
7 29 253 253 =EOL |\x0a
8 0 254 254 +DOC |
8 0 254 254 =HEAD|---
8 3 257 257 +NODE|
8 3 257 257 =WSPC|.
8 4 258 258 +PROP|
8 4 258 258 +TAG |
8 4 258 258 +HAND|
8 4 258 258 =SYNX|!
8 5 259 259 =SYNX|!
8 6 260 260 -HAND|
8 6 260 260 =META|omap
8 10 264 264 -TAG |
8 10 264 264 -PROP|
8 10 264 264 =EOL |\x0a
9 0 265 265 +SEQ |
9 0 265 265 =SYNX|-
9 1 266 266 =DENT|.
9 2 267 267 +NODE|
9 2 267 267 +MAP |
9 2 267 267 +PAIR|
9 2 267 267 +NODE|
9 2 267 267 +VAL |
9 2 267 267 =TEXT|Mark.McGwire
9 14 279 279 -VAL |
9 14 279 279 -NODE|
9 14 279 279 =SYNX|:
9 15 280 280 =WSPC|.
9 16 281 281 +NODE|
9 16 281 281 +VAL |
9 16 281 281 =TEXT|65
9 18 283 283 -VAL |
9 18 283 283 -NODE|
9 18 283 283 =EOL |\x0a
10 0 284 284 -PAIR|
10 0 284 284 -MAP |
10 0 284 284 -NODE|
10 0 284 284 =SYNX|-
10 1 285 285 =DENT|.
10 2 286 286 +NODE|
10 2 286 286 +MAP |
10 2 286 286 +PAIR|
10 2 286 286 +NODE|
10 2 286 286 +VAL |
10 2 286 286 =TEXT|Sammy.Sosa
10 12 296 296 -VAL |
10 12 296 296 -NODE|
10 12 296 296 =SYNX|:
10 13 297 297 =WSPC|.
10 14 298 298 +NODE|
10 14 298 298 +VAL |
10 14 298 298 =TEXT|63
10 16 300 300 -VAL |
10 16 300 300 -NODE|
10 16 300 300 =EOL |\x0a
11 0 301 301 -PAIR|
11 0 301 301 -MAP |
11 0 301 301 -NODE|
11 0 301 301 =SYNX|-
11 1 302 302 =DENT|.
11 2 303 303 +NODE|
11 2 303 303 +MAP |
11 2 303 303 +PAIR|
11 2 303 303 +NODE|
11 2 303 303 +VAL |
11 2 303 303 =TEXT|Ken.Griffy
11 12 313 313 -VAL |
11 12 313 313 -NODE|
11 12 313 313 =SYNX|:
11 13 314 314 =WSPC|.
11 14 315 315 +NODE|
11 14 315 315 +VAL |
11 14 315 315 =TEXT|58
11 16 317 317 -VAL |
11 16 317 317 -NODE|
11 16 317 317 =EOL |\x0a
12 0 318 318 -PAIR|
12 0 318 318 -MAP |
12 0 318 318 -NODE|
12 0 318 318 -SEQ |
12 0 318 318 -NODE|
12 0 318 318 -DOC |
na
[
{
'Mark McGwire' => 65
},
{
'Sammy Sosa' => 63
},
{
'Ken Griffy' => 58
}
]
na
[
{
'Mark McGwire' => 65
},
{
'Sammy Sosa' => 63
},
{
'Ken Griffy' => 58
}
]
na
[
{
'Mark McGwire' => 65
},
{
'Sammy Sosa' => 63
},
{
'Ken Griffy' => 58
}
]
na
[
{
'Mark McGwire' => 65
},
{
'Sammy Sosa' => 63
},
{
'Ken Griffy' => 58
}
]
na
[('Mark McGwire', 65), ('Sammy Sosa', 63), ('Ken Griffy', 58)]
na
ordereddict({'Mark McGwire': 65, 'Sammy Sosa': 63, 'Ken Griffy': 58})
ni
Unhandled exception. YamlDotNet.Core.YamlException: (Line: 8, Col: 5, Idx: 258) - (Line: 9, Col: 1, Idx: 265): Encountered an unresolved tag 'tag:yaml.org,2002:omap'
at YamlDotNet.Serialization.NodeTypeResolvers.PreventUnknownTagsNodeTypeResolver.YamlDotNet.Serialization.INodeTypeResolver.Resolve(NodeEvent nodeEvent, Type& currentType)
at YamlDotNet.Serialization.ValueDeserializers.NodeValueDeserializer.GetTypeFromEvent(NodeEvent nodeEvent, Type currentType)
at YamlDotNet.Serialization.ValueDeserializers.NodeValueDeserializer.DeserializeValue(IParser parser, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer)
at YamlDotNet.Serialization.ValueDeserializers.AliasValueDeserializer.DeserializeValue(IParser parser, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer)
at YamlDotNet.Serialization.Deserializer.Deserialize(IParser parser, Type type)
at YamlDotNet.Serialization.Deserializer.Deserialize(TextReader input, Type type)
at YamlDotNet.Serialization.Deserializer.Deserialize(TextReader input)
at Program.Main(String[] commandLineArguments)
Aborted (core dumped)
ni
YAML::Tiny does not support a feature in line '!!omap' at /yaml/bin/perl-tiny-json line 12.
ni
YAML::Tiny does not support a feature in line '!!omap' at /yaml/bin/perl-tiny-perl line 15.
ni
YAML::XS::Load Error: The problem:
bad tag found for array: 'tag:yaml.org,2002:omap'
was found at document: 1
ni
YAML::XS::Load Error: The problem:
bad tag found for array: 'tag:yaml.org,2002:omap'
was found at document: 1