Hello! Can anyone guide me toward instructions for parsing a YAML file? I want to use a YAML config file for a module that I’m building, but I have no idea where to start.
Is there a reason not to just use Json?
I might just do that.
One could argue that YML is easier for “normal people” to write correctly, but I strongly prefer JSON also because it has the wonderful combination of simplicity and flexibility. It’s supported by all programming languages, natively so in most. And there are all kinds of tools like
jq that make working with it easy from the command line.
There are plenty of YAML parsing libraries and tooling out there, so look around. There are other possible formats that could serve as well, depending on the complexity of structure you want to express. (CSV, INI, TOML, etc).
Personally, I dislike YAML because significant white space is generally evil, but having an excellent YAML-aware editor can make it less so.
Since VCV and plugins already use JSON extensively, I don’t think there’s a big advantage to some other format.
I’m trying to use the Jansson json functions in a helper class that’s not in my main module. Any suggestions what the include should look like? I spent way too much time arguing with ChatGPT over it. Ha ha ha.
Look at other modules that use it. Many do.
This is far from a great example, but this is what I did last time I had to do that:
Sorry for the late reply – I didn’t see this previously. Thank you for the solution!