Let’s assume there is a settings.json with the basic settings as objects inside, I’m loading it into vvvv with xelement. I’m trying to “overwrite” the objects inside in an automated manner. The new objects are send into vvvv in realtime. If there is a new object-value, color,… then the new data should be displayed. if not, the settings should be used. I managed to prune every possible objectname and overwrite with a simple switch(string), but i need to set a prune for every objectname i’m using. I’d like to merge these automated since objects may be nested or arrays. Maybe someone has a hint. :)
that sounds like a job for vl, that allows you to deal with this on an “object” level rather than a string level. can you share the settings file so we can make this into a little demo?
Yes, VL might be useful here. I uploaded a sample JSON without real content and a small patch. Let’s say the Live Input will be stored in a S+H and can then be applied on the settings.
JSON merge.zip (2.5 KB)
ouright, even easier than i thought, since Json.NET comes with readytouse json.Merge() functionality that seems to do exactly what you’re looking for.
so all i had to do was reference Newtonsoft.Json as a dependency to the document:
and then follow the c# demo code for the json.Merge():
mergejson.zip (13.2 KB)
edit: forgot to mention, this works only with latest alphas!
Thank you Joreg, that’s exactly what I need! There are only two small things: when the JSON is not 100% correct, e.g. a comma is missing, a errormessage pops up. not very handy sometimes and the fact that it’s in the alpha release. Are there plans for the 36 release?
start vvvv with /showexceptions false parameter.