I'm writing a thing that serialized a ValueTree to xml and back for storing the plugin state. However, the xmlalized ValueTree seems to discard var type information so that when I recreate the ValueTree from xml it thinks everything is a string. What's the best solution for this? I could parse all the strings into the correct type but that seems messy.
Yeah, that is a drawback of using XML - the way the ValueTree gets converted to XML favours readability over type data.
The reason it's done like that is that if you don't need the output to be human-readable, then you'd be better off using the binary conversion, as it's both faster, smaller, and type-correct.
Ah right, ok. So regarding plugin state saving, I could create a MemoryOutputStream to the state MemoryBlock and write the ValueTree to that? Would I need a "magic number" like in copyXmlToBinary()?