Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for YAML. More Types by pakhomovegor
def yaml(a):
dict={}
for line in a.splitlines():
if line:
k,v=line.split(":",1)
v=v.strip(" ")
if v.isnumeric():
dict[k]=int(v)
elif v=="" or v=="null":
dict[k]=None
elif v=="false":
dict[k]=False
elif v=="true":
dict[k]=True
else:
dict[k]=v.replace('\\"','quote&').strip('"').replace('quote&','"')
return dict
July 29, 2021
Comments: