Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
if else... solution in Clear category for YAML. More Types by Olpag
def yaml(a):
t = (i.strip() for i in a.split('\n') if i)
d = {}
for elem in t:
key, val = (i.strip() for i in elem.split(':'))
if val == 'null': val = ''
if val.startswith('"'): val = val[1:-1]
val = val.replace('\\"', '"')
d[key] = int(val) if val.isdecimal() else \
None if (not val) else \
val.lower() == 'true' if val.lower() in ['false', 'true'] else val
return d
Nov. 14, 2019