probably a silly question. I am trying to make use of self '$' when defining/reading a json.
* def x = {a:1,b:{c:'#($.a)'},d:2}
* print x
It fails.
"a": 1,
"b": {
"c": "#($.a)"
},
"d": 2
}
Is it possible to do something like above? At the time of defining variable, when the compiler reaches 'c', 'a' has already been defined. So, I am hopeful that it might be possible.
But I do understand there are edge cases of cyclic reference (referring '$') or referring something that is not yet defined('$.d'), but those cases can be handled to throw exception.