What's the most SuperCollider way to convert a dictionary to yaml?

The String class has the parseYAML and parseYAMLFile methods that convert files and strings into dictionaries - but there doesn’t seem to be any sort of inverse method that converts dictionaries to yaml strings.

A quick google search lead me to this stackoverflow question where the user apparently uses JSON.stringify which seems to be javascript, and not SuperCollider. I’m not a big fan of this idea, and I’d rather just roll the yaml conversion myself - I’m just wondering if anyone possibly knows of any Quarks or anything else that might already exist that could help me out?

JSON is a class in the API quark: API/JSON.sc at master · crucialfelix/API · GitHub
No javascript involved really.

Turning arbitrary sclang dictionaries in JSON probably is hard because dictionaries can contain almost anything, but the JSON quark looks like it is good enough to handle dictionaries containing numbers, strings, dictionaries, symbols and collections (which may be enough for your needs?).

1 Like

Thanks for clarifying that for me! For some reason I hadn’t thought that JSON interface was actually part of a supercollider quark!