While I am trying to convert yaml string to Map I am getting key change.
YAML File:-
---
HK:
isp:
Airtel: AirtelChennal
www.enemalta.com:
default: defaultEma
user1: chennal1
studiodefault: hkDefaultchennal
country:
DK: denmarkChennal
NO: chennal2
Java code:-
Yaml yaml= new Yaml();
Map<String,Object> map= (Map<String, Object>) yaml.load(yamlString);
output :-
{HK={isp={Airtel=AirtelChennal}, www.enemalta.com={default=defaultEma, user1=chennal1}, studiodefault=hkDefaultchennal, country={DK=denmarkChennal, false=chennal2}}}
in above output false is replace with "NO", but I need "NO" as it is.
Expected output:-
{HK={isp={Airtel=AirtelChennal}, www.enemalta.com={default=defaultEma, user1=chennal1}, studiodefault=hkDefaultchennal, country={DK=denmarkChennal, NO=chennal2}}}
According to this article: http://makandracards.com/makandra/24809-yaml-keys-like-yes-or-no-evaluate-to-true-and-false
In order to use the strings ‘yes’ and ‘no’ as keys, you need to wrap them with quotes
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With