Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
YAML. More Types solution in Clear category for YAML. More Types by JimmyCarlos
def yaml(yaml_input):
yaml_dict = {}
yaml_input = yaml_input.replace("\\","")
for line in yaml_input.split("\n"):
if ":" not in line: continue
k,v = [x.strip() for x in line.split(":")]
if v == "" or v == "null": v = None
elif v.lower() == "false": v = False
elif v.lower() == "true": v = True
elif v.isnumeric(): v = int(v)
elif v[0] == v[-1] and v[0] in "\"'": v = v[1:-1]
yaml_dict[k] = v
print(yaml_dict)
return yaml_dict
Nov. 16, 2019
Comments: