Skip to content

Commit 1100921

Browse files
committed
Added note on YAML mappings as objects
1 parent 7b8b8aa commit 1100921

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Diff for: components/yaml/introduction.rst

+13
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,16 @@ error if something goes wrong by adding the filename to the message.
148148

149149
.. _components-yaml-dump:
150150

151+
Objects for Mappings
152+
....................
153+
154+
Yaml mappings_ are basically associative arrays. You can instruct the parser to return
155+
mappings as objects (i.e. ``\stdClass`` instances)::
156+
157+
$object = $parser->parse('{"hello": "world"}', false, false, true);
158+
echo get_class($object); // stdClass
159+
echo $object->hello; // world
160+
151161
Writing YAML Files
152162
~~~~~~~~~~~~~~~~~~
153163

@@ -219,6 +229,9 @@ representation to the inline one:
219229
foo: bar
220230
bar: baz
221231
232+
233+
222234
.. _YAML: http://yaml.org/
223235
.. _Packagist: https://packagist.org/packages/symfony/yaml
224236
.. _`YAML 1.2 version specification`: http://yaml.org/spec/1.2/spec.html
237+
.. _mappings: http://symfony.com/doc/current/components/yaml/yaml_format.html#collections

0 commit comments

Comments
 (0)