Sign in

Parse EDN content and give a JSON out

There was a problem that the LLM was not able to address. Please rephrase your prompt and try again.
import json import edn_format def edn_to_map(x): if isinstance(x, edn_format.ImmutableDict): return {edn_to_map(k): edn_to_map(v) for k, v in x.items()} elif isinstance(x, edn_format.ImmutableList): return [edn_to_map(v) for v in x] elif isinstance(x, edn_format.Keyword): return x.name elif isinstance(x, frozenset): return [edn_to_map(t) for t in x] else: return x # Parse the EDN string parsed_data = edn_format.loads(edn_string) parsed_dict = edn_to_map(parsed_data) print(json.dumps(parsed_dict, indent=4))
copied