Open mfreeman-xtivia opened 9 months ago
So can JEXL be used as a tranform language or just an expression evaluator only?
For example, if I wanted to use JEXL against the following:
{ "name": { "first": "Sterling", "last": "Archer" }, "assoc": [ { "first": "Lana", "last": "Kane" }, { "first": "Cyril", "last": "Figgis" }, { "first": "Pam", "last": "Poovey" } ], "age": 36 }
and simply return the array contents of "assoc" but with last names upper-cased, is that possible with JEXL? (i.e i would like to output something like this:
[ { "first": "Lana", "last": "KANE" }, { "first": "Cyril", "last": "FIGGIS" }, { "first": "Pam", "last": "POOVEY" } ]
JexlPlayground)%2C%0A%7D)
You can add the following transform (for example) mapToUpper: (arr) => arr.map(o => ({first: o.first, last: o.last.toUpperCase()}))
mapToUpper: (arr) => arr.map(o => ({first: o.first, last: o.last.toUpperCase()}))
And you can call it like this assoc|mapToUpper
assoc|mapToUpper
So can JEXL be used as a tranform language or just an expression evaluator only?
For example, if I wanted to use JEXL against the following:
{ "name": { "first": "Sterling", "last": "Archer" }, "assoc": [ { "first": "Lana", "last": "Kane" }, { "first": "Cyril", "last": "Figgis" }, { "first": "Pam", "last": "Poovey" } ], "age": 36 }
and simply return the array contents of "assoc" but with last names upper-cased, is that possible with JEXL? (i.e i would like to output something like this:
[ { "first": "Lana", "last": "KANE" }, { "first": "Cyril", "last": "FIGGIS" }, { "first": "Pam", "last": "POOVEY" } ]