Object operations group is intended to perform different data manipulations
with JavaScript
objects.
Let's say we have a JavaScript file with JavaScript object and some
primitive variable:
count = 79;
person = {
name: 'John',
country: 'Canada',
age: 30
};
The following table explains each operation and shows examples related to the
JavaScript file above:
Operation |
Explanation |
Example |
Result |
~K |
Resolves object keys as array. The result will be always a JavaScript
array even if the object
has only 1 item.
|
${person~K}
|
[
"name",
"country",
"age"
]
|
~V |
Resolves object values as array. The result will be always a JavaScript
array even if the object has only 1 item.
|
${person~V}
|
[
"John",
"Canada",
30
]
|
~O |
Transforms a primitive values and arrays to object. |
${count~O}
|
{
"count": 79
}
|
~X |
Converts a JavaScript object to XML. |
${person~X}
|
<?xml version='1.0'?>
<person>
<name>John</name>
<country>Canada</country>
<age>30</age>
</person>
|
~Y |
Converts a JavaScript object to YAML. |
${person~Y}
|
name: John
country: Canada
age: 30
|
~P |
Converts a JavaScript object to Java Property file. |
${person~P}
|
name=John
country=Canada
age=30
|
You can chain those operations depending on your needs.
For example we can convert a
count primitive variable to XML with the
following expression:
${count~O~X}
The result will be:
<?xml version='1.0'?>
<count>
<count>384400</count>
</count>