Reading YAML with type conversion disabled
Hello,
I'm wondering if there is some clean way of reading YAML file, having type conversion disabled.
What I want to achieve, is to give developer a possibility to work with file which is highly readable. Consider YAML file which consists of some resources used for translating the application.
It could look like this:
i18n:
header:
# here we define header related stuff
title: Some title
yes: yes
no: no
but as "yes" and "no" are restricted keyword we have to use doublequotes for everything (yep, there are also some singlequote or semicolons signs later on in values so I use doublequotes everywhere). Just to be sure that everything is read as String when parsing YAML, the file has too look like this.
"i18n":
"header":
# here we define header related stuff
"title": "Some title"
"yes": "yes"
"no": "no"
For me it decreases readability.
I didn't find solution for this in Java anywhere (only some proposal to use BaseLoader, but it was Python related).
I would appreciate any help.
Comments (3)
-
reporter -
This is not a bug. We have a mailing list for general questions. You can also try stackoverflow.
This is the link in the tutorial: https://bitbucket.org/asomov/snakeyaml/wiki/Documentation#markdown-header-implicit-types
Providing your own Resolver you can enable/disable any implicit conversion.
-
reporter Thanks for the link. BTW - I've set 'Proposal' as issue type, not 'Bug'.
- Log in to comment
I can vote for my own issues. Nice ;)