std::vector<juce::AudioProcessorValueTreeState> presets;

Is it workable to use a vector of AudioProcessorValueTreeState to store presets?
If so, how would you read/write all presets as one xml document, to and from a file?

No. There is meant to be one AudioProcessorValueTreeState.

The state data itself is a ValueTree; you could have a std::vector<ValueTree>.

OK, that makes sense.
So you could store plugin presets in a std::vector<juce::ValueTreeState>, and then update the AudioProcessorValueTreeState according to the selected preset?
If so, the second question remains: how would you read/write a std::vector<juce::ValueTreeState> as one xml document, to and from a file?
Guess I am looking for an xml merge and split…

I would make one “parent” ValueTree and append each preset as a child of it.

For example:

std::vector<juce::ValueTree> presets;

void savePresets (juce::File destFile)
{
    juce::ValueTree presetData { "MyPluginPresets" };

    for (const auto& preset : presets)
        presetData.appendChild (preset, nullptr);

    const auto xml = presetData.createXml();

    xml->writeTo (destFile);
}

and to load them do the inverse, load a single ValueTree from the file, then loop through all its child trees.

This is worth watching as a primer: Preset Manager in JUCE || Akash Murthy - YouTube

If one ValueTree represents one preset, it could make sense to store each preset as an individual file on disk, instead of in one large xml file.

You can use ValueTree::toString and ValueTree::fromXml to serialize the tree and then use the juce File class to write and read to files on disk.
To update the current preset, use AudioProcessorValueTreeState::replaceState.

You could indeed create a vector of ValueTree’s representing all presets, however in some cases creating a vector of Files is more suitable. In that case converting to ValueTree would happen at the moment when a user selects the preset. If you have thousands of presets, this way you don’t block the GUI while creating all the ValueTree’s.

The AudioProcessorValueTreeState has a public state ValueTree that represents the state of all parameters and whatever you add to it.
It is trivial to store that state in a savePreset method and to assign it balc in a loadPreset Method.
How you organise those presets is up to you, could be one file or multiple files. Just be aware that a ValueTree can only be child to one ValueTree, so you need to use createCopy():

void savePreset()
{
    auto preset = apvts.state.createCopy();
    presets.appendChild (preset, nullptr);
}

void loadPreset (int index)
{
    auto preset = presets.getChild (index).createCopy();
    apvts.replaceState (preset);
}

All good input, thanks! :+1: :+1: :+1: