Functions
divideBy
divideBy(Object, Number): Array<Object>
Divides the object into sub objects with the specified amount of properties
Transform
1
2
3
output application/json
---
{a: 123,b: true, a:123, b:false} divideBy 2
Output
1
2
3
4
5
6
7
8
9
10
[
{
"a": 123,
"b": true
},
{
"a": 123,
"b": false
}
]
entrySet
entrySet(T)
Returns a list of key value pair object describing the object entries
Example
1
2
3
4
%dw 2.0
import dw::core::Objects
---
Objects::entrySet({a: true, b: 1})
Output
1
[ {"key": "a", "value": true}, {"key": "b", "value": 1} ]
keySet
keySet(T): ?
Returns the list of key names of an object
Example
1
2
3
4
%dw 2.0
import dw::core::Objects
---
Objects::nameSet({a: true, b: 1})
Output
1
["a","b"]
mergeWith
mergeWith(T, V): ?
Overrides the source with the target object so that the result with contain all the properties from the target plus the properties on the source that are not declared on the target
Example
1
2
3
4
%dw 2.0
import mergeWith from dw::core::Objects
---
{a: true, b: 1} mergeWith {a: false, c: "Test"}
Output
1
{"a": false, "b": 1 , "c": "Test"}
mergeWith(Null, T): T
Helper method to make mergetWith
null friendly
mergeWith(T, Null): T
Helper method to make mergetWith
null friendly
nameSet
nameSet(Object): Array<String>
Returns the list of key names of an object
Example
1
2
3
4
%dw 2.0
import dw::core::Objects
---
Objects::nameSet({a: true, b: 1})
Output
1
["a","b"]
valueSet
valueSet({ (K)?: V }): Array<V>
Returns the list of key values of an object
Example
1
2
3
4
%dw 2.0
import dw::core::Objects
---
Objects::nameSet({a: true, b: 1})
Output
1
[true,1]