Operations (sample payloads)
Main operations
Add key/value pairs
Adds key/value pairs from a list array to a source object as properties and returns a singular object. The source object can either be empty or populated with properties. The list array contains objects and each object will have the fields key and value. Sample Input
{
"source": {
"existingKey": "existingValue"
},
"list": [
\{
"key": "name",
"value": "John Doe"
\},
\{
"key": "age",
"value": 30
\},
\{
"key": "isEmployee",
"value": true
\},
\{
"key": "hobbies",
"value": [
"reading",
"swimming"
]
\},
{
"key": "address",
"value": \{
"street": "123 Main St",
"city": "Anytown",
"country": "USA"
\}
}
]
}
Sample Output
{
"result": {
"existingKey": "existingValue",
"name": "John Doe",
"age": 30,
"isEmployee": true,
"hobbies": [
"reading",
"swimming"
],
"address": \{
"street": "123 Main St",
"city": "Anytown",
"country": "USA"
\}
}
}
Add value by key
Add a value to an object by its key. Sample Input
{
"source": \{
"name": "John Doe",
"age": 30
\},
"key": "email",
"value": "johndoe@example.com"
}
Sample Output
{
"result": \{
"name": "John Doe",
"age": 30,
"email": "johndoe@example.com"
\}
}
Contains
Returns true if an object contains an assigned value, false otherwise. Sample Input
{
"source": {
"user": {
"name": "John Doe",
"age": 30,
"address": \{
"street": "123 Main St",
"city": "New York",
"country": "USA"
\},
"email": "john.doe@example.com"
}
},
"key": "user.address.street"
}
Sample Output
{
"result": true
}
Delete key value pair
Delete a key value pair with a given key. Sample Input
{
"source": {
"id": 123,
"user": {
"name": "John Doe",
"email": "john@example.com",
"address": \{
"street": "123 Main St",
"city": "Anytown",
"country": "USA"
\}
},
"status": "active"
},
"key": "user.address.street"
}
Sample Output
{
"result": {
"id": 123,
"user": {
"name": "John Doe",
"email": "john@example.com",
"address": \{
"city": "Anytown",
"country": "USA"
\}
},
"status": "active"
}
}
Enforce object structure
Define a JSON structure which the output object must adhere to. The output object will contain at least the defined structure along with any additional fields from the input. Sample Input
{
"source": {
"name": "John Doe",
"age": 30,
"email": "johndoe@example.com",
"address": \{
"street": "123 Main St",
"city": "Anytown"
\},
"hobbies": [
"reading",
"swimming"
]
},
"structure": {
"name": "",
"age": null,
"email": "",
"phone": "",
"address": \{
"street": "",
"city": "",
"zipcode": ""
\}
}
}
Sample Output
{
"result": {
"name": "John Doe",
"age": 30,
"email": "johndoe@example.com",
"phone": null,
"address": \{
"street": "123 Main St",
"city": "Anytown",
"zipcode": null
\},
"hobbies": [
"reading",
"swimming"
]
}
}
Equals
Returns true if an object is exactly the same as another object, false otherwise. Sample Input
{
"source": \{
"name": "John Doe",
"age": 30,
"city": "New York"
\},
"target": \{
"name": "John Doe",
"age": 30,
"city": "New York"
\}
}
Sample Output
{
"result": true
}
Find difference
Finds the difference between two objects and returns it. Sample Input
{
"source": \{
"name": "John Doe",
"age": 30,
"city": "New York",
"occupation": "Engineer"
\},
"target": \{
"name": "John Doe",
"age": 31,
"city": "Los Angeles",
"hobbies": [
"reading",
"swimming"
]
\}
}
Sample Output
{
"source": \{
"age": 30,
"city": "New York",
"occupation": "Engineer"
\},
"target": \{
"age": 31,
"city": "Los Angeles",
"hobbies": [
"reading",
"swimming"
]
\}
}
Get value by key
Get a value from an object by its key. Sample Input
{
"source": {
"user": {
"name": "John Doe",
"age": 30,
"address": \{
"street": "123 Main St",
"city": "New York",
"country": "USA"
\},
"hobbies": [
"reading",
"swimming",
"photography"
]
},
"company": "Acme Inc.",
"isActive": true
},
"key": "user.address.city",
"default": "Unknown"
}
Sample Output
{
"result": "New York"
}
Iterative transform
Given an object, iterate through its properties, and transform the associated keys and values accordingly. Sample Input
{
"source": \{
"firstName": "John",
"lastName": "Doe",
"age": 30,
"email_address": "john.doe@example.com",
"phone_number": "123-456-7890"
\},
"key_transform": "snake_case",
"value_transform": "upper_case"
}
Sample Output
{
"source": \{
"firstName": "John",
"lastName": "Doe",
"age": 30,
"email_address": "john.doe@example.com",
"phone_number": "123-456-7890"
\},
"target": \{
"first_name": "JOHN",
"last_name": "DOE",
"age": "30",
"email_address": "JOHN.DOE@EXAMPLE.COM",
"phone_number": "123-456-7890"
\}
}
JSON parse
Take a JSON string/text and parse it into an object. Sample Input
{
"source": "\{\"name\":\"John Doe\",\"age\":30,\"city\":\"New York\",\"isStudent\":false,\"hobbies\":[\"reading\",\"swimming\",\"photography\"]\}"
}
Sample Output
{
"result": \{
"name": "John Doe",
"age": 30,
"city": "New York",
"isStudent": false,
"hobbies": [
"reading",
"swimming",
"photography"
]
\}
}
JSON stringify
Take an object and transform it into a JSON string. Sample Input
{
"source": {
"name": "John Doe",
"age": 30,
"email": "johndoe@example.com",
"isSubscribed": true,
"hobbies": [
"reading",
"swimming",
"cycling"
],
"address": \{
"street": "123 Main St",
"city": "Anytown",
"country": "USA"
\}
}
}
Sample Output
{
"result": "{\"name\":\"John Doe\",\"age\":30,\"email\":\"johndoe@example.com\",\"isSubscribed\":true,\"hobbies\":[\"reading\",\"swimming\",\"cycling\"],\"address\":\{\"street\":\"123 Main St\",\"city\":\"Anytown\",\"country\":\"USA\"\}}"
}
Map keys
Given an object, transform the given property key names. Sample Input
{
"source": \{
"firstName": "John",
"lastName": "Doe",
"emailAddress": "john.doe@example.com",
"phoneNumber": "123-456-7890"
\},
"key_transformations": [
\{
"source_key": "firstName",
"target_key": "first_name"
\},
\{
"source_key": "lastName",
"target_key": "last_name"
\},
\{
"source_key": "emailAddress",
"target_key": "email"
\},
\{
"source_key": "phoneNumber",
"target_key": "phone"
\}
]
}
Sample Output
{
"result": \{
"first_name": "John",
"last_name": "Doe",
"email": "john.doe@example.com",
"phone": "123-456-7890"
\}
}
Merge two objects
Merge two objects. If there is any property specified in both objects, the one specified in the first (source object) will be used. Sample Input
{
"source": \{
"name": "John Doe",
"age": 30,
"email": "john@example.com"
\},
"target": \{
"age": 35,
"occupation": "Developer",
"city": "New York"
\}
}
Sample Output
{
"result": \{
"name": "John Doe",
"age": 30,
"email": "john@example.com",
"occupation": "Developer",
"city": "New York"
\}
}
Pick values by keys
Pick values from an object by its keys. Sample Input
{
"source": \{
"name": "John Doe",
"age": 30,
"email": "johndoe@example.com",
"address": "123 Main St",
"city": "New York",
"country": "USA"
\},
"keys_to_pick": [
"name",
"email",
"country"
]
}
Sample Output
{
"result": \{
"name": "John Doe",
"email": "johndoe@example.com",
"country": "USA"
\}
}
Properties exist
Check if a list of properties are found in an object. If any are not found, a list of the properties not found is returned. Sample Input
{
"source": {
"user": \{
"name": "John Doe",
"email": "john.doe@example.com",
"age": 30
\},
"order": \{
"id": "ORD-123",
"total": 99.99
\}
},
"property_keys": [
"user.name",
"user.email",
"user.phone",
"order.id",
"order.date"
]
}
Sample Output
\{
"found": [
"user.name",
"user.email",
"order.id"
],
"not_found": [
"user.phone",
"order.date"
],
"found_all": false
\}
Remove null values
Remove Null and/or empty String values from an object. Sample Input
{
"source": {
"name": "John Doe",
"age": 30,
"email": "",
"phone": null,
"address": \{
"street": "123 Main St",
"city": "New York",
"state": null,
"zip": ""
\},
"hobbies": [
"reading",
null,
"swimming"
]
},
"values_to_remove": "both"
}
Sample Output
{
"result": {
"name": "John Doe",
"age": 30,
"address": \{
"street": "123 Main St",
"city": "New York"
\},
"hobbies": [
"reading",
"swimming"
]
}
}