jbeder / yaml-cpp

A YAML parser and emitter in C++
MIT License
4.92k stars 1.78k forks source link

Parsing quoted numbers as strings, not int/float/double #1166

Closed NikOsint closed 1 year ago

NikOsint commented 1 year ago

The problem that I have faced using yaml-cpp library is that numbers (both integers and float/double) are always parsed as integers/float/double respectively regardless of the presence of quotes. In other libraries (for example, libyaml, which is used in PHP YAML module) data which is framed by quotes is always parsed as string (which, in my opinion, is a more correct way).

If there is a setting/method that allows me to make yaml-cpp behave like I have just described, please tell me, because I have not found any way to do so.

jbeder commented 1 year ago

yaml-cpp allows you to parse it any way you want, and lets you know if it thinks it should be a string by looking at the tag.

NikOsint commented 1 year ago

@jbeder thank you for such a quick response! Tags are something I haven't tried yet:)