I'm looking for a language that would be suitable for describing tree-like application data migration.
We have an application that keeps it's data as a tree of "objects". If you try to express it as JSON, you can get something like that:
{
"ROOT_OBJECT": {
"@parameter1": 42,
"@parameter2": "asdf",
"CHILD_OBJECT": {
"@parameter1": {
"@subparameter1": 1
},
"@parameter2": [ "one", "two" ],
"GRANDCHILD_OBJECT": {
"@parameter1": 42
}
}
}
}
The structure of the data evolves over time. The new application version might want to add some new parameters, remove some old ones, move parameters from one object to another, merge or split objects etc.
Such data migration can be written in an imperative language like Java or JavaScript (and it's more or less the way it is done now), but our intention is to move to a declarative one.
Currently we're developing an implementation that uses XSLT: it converts the tree to a DOM tree, applies an XSL transformation, then converts the result back to the original tree format.
I wonder whether there is an alternative way of doing such data transformation. Ideally the candidate language already has an implementation in Java and JavaScript, or at least in JavaScript.