Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Simple solution in Clear category for YAML. More Types by suic
def convert_value(value):
if value == "false":
return False
if value == "true":
return True
if value == "null":
return None
if value.isdigit():
return int(value)
return value.replace('"', '').replace("\\", '"').strip()
def yaml(a):
obj = {}
for field in a.split('\n'):
if not field.strip():
continue
k, *v = field.split(": ")
obj[k.rstrip(":")] = convert_value(v[0]) if v else None
return obj
April 3, 2020
Comments: