Search code examples
yamlsupercollider

SuperCollider: convert a Dictionary to YAML


SuperCollider has a String:parseYAML method that can create a nested Dictionary:

"{44: 'woo'}".parseYAML

Dictionary[ (44 -> woo) ]

But how to go the other way, output a YAML string given a (possibly nested) Dictionary?


Solution

  • [answer is from someone else outside]

    Does the document have to be readable?

    I've ben using JSON.stringify from Felix's API quark In order to share dictionaries with an Max MSP application.

    The result from this method is not readable, that is, it doesn't generate any newlines and tabs etc. So it doesn look pretty in a text document, but that's not the intention with method design I can imagine.