Skip to content

Commit aa1b968

Browse files
javiereguiluzxabbuh
authored andcommitted
Explained the explicit typing in YAML documents
1 parent 7a58612 commit aa1b968

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

components/yaml/yaml_format.rst

+18
Original file line numberDiff line numberDiff line change
@@ -300,4 +300,22 @@ Comments can be added in YAML by prefixing them with a hash mark (``#``):
300300
Comments are simply ignored by the YAML parser and do not need to be
301301
indented according to the current level of nesting in a collection.
302302

303+
Explicit Typing
304+
---------------
305+
306+
The YAML specification defines some tags to set the type of any data explicitly:
307+
308+
.. code-block:: yaml
309+
310+
data:
311+
# this value is parsed as a float number (it will be 3.0 instead of 3)
312+
price: !!float 3
313+
314+
# this value is parsed as binary data encoded in base64
315+
picture: !!binary |
316+
R0lGODlhDAAMAIQAAP//9/X
317+
17unp5WZmZgAAAOfn515eXv
318+
Pz7Y6OjuDg4J+fn5OTk6enp
319+
56enmleECcgggoBADs=
320+
303321
.. _YAML: http://yaml.org/

0 commit comments

Comments
 (0)