Reading YAML with type conversion disabled

Issue #353 resolved
jmayday created an issue

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)

  1. Log in to comment