Store ValueTree Array<var> in JSON/XML problem


#1

I want to store Array in ValueTrees and create a Document.

If use XML, it seems threre is no Array support, it just displays [ARRAY]…

why not do something like value=“1;2;3;4”

if use JSON, how to convert a ValueTree into JSON and back?

:?


#2

Not possible. The structure of JSON/var data is very different from XML/ValueTrees. To convert them you’d need to write your own algorithm for the data you’re working with.


#3

okay, but Array in XML would be cool… (but till then … okay i use my own converter functions…)


#4

XML doesn’t have any kind of concept of “arrays”!


#5

Yes, anyway it would be great to have the possibility (however) to store a ValueTree with all its possibilities into a MemoryBlock/String.
In times, where on modern OS, a application should store its current state immediately on disk, this would be cool!

If i use arrays then Xml Conversion wouldn’t work.
If i use JSON then ValueTree Conversion would’t work.
If i use dynamic Objects “writeToStream()” wouldn’t work.
If i use strings instead of dynamic Objects, its just a waste of memory/cpu not very elegant.

So i need 1 of this four possibilities

  1. make it possible to store/restore an array with xml (you already mentioned here http://www.rawmaterialsoftware.com/viewtopic.php?f=2&t=7367&hilit=valuetree+json#p41823)
  2. make it possible to convert between JSON -> ValueTree
  3. enable writeToStream() for dynamic Objects
  4. extend var to be also MemoryBlock, which has writeToStream

Convert C array to Juce Array