Object
Object transforms operate on JSON objects.
object.copy
Copies values into, from, and between JSON keys.
Settings
Field | Type | Description | Required |
---|---|---|---|
object.source_key | string | Retrieves a value from an object for transformation. | No |
object.target_key | string | Places a value into an object after transformation. | No |
Example
sub.transform.object.copy(
settings={object: {source_key: 'a', target_key: 'z'}}
)
sub.tf.obj.cp({obj: {src: 'a', trg: 'z'}})
object.delete
Deletes a key from a JSON object.
Settings
Field | Type | Description | Required |
---|---|---|---|
object.source_key | string | Key that is deleted from the object. | Ye |
Example
sub.transform.object.delete(
settings={object: {source_key: 'a'}}
)
sub.tf.obj.del({obj: {src: 'a'}})
object.insert
Inserts a static value into a JSON object.
Settings
Field | Type | Description | Required |
---|---|---|---|
object.target_key | string | Places a value into an object after transformation. | Yes |
value | any | Value set into the object. | Yes |
Example
sub.transform.object.insert(
settings={object: {target_key: 'x'}, value: 'abc'}
)
sub.tf.obj.insert({obj: {trg: 'x'}, value: 'abc'})
object.jq
Applies a JQ filter to a JSON object.
Settings
Field | Type | Description | Required |
---|---|---|---|
filter | string | jq filter applied to the object. | Yes |
object.to.boolean
Converts a JSON value to a boolean.
Settings
Field | Type | Description | Required |
---|---|---|---|
object.source_key | string | Retrieves a value from an object for transformation. | No |
object.target_key | string | Places a value into an object after transformation. | No |
Example
sub.transform.object.to.boolean(
settings={object: {source_key: 'a', target_key: 'z'}}
)
sub.tf.obj.to.bool({obj: {src: 'a', trg: 'z'}})
object.to.float
Converts a JSON value to a float.
Settings
Field | Type | Description | Required |
---|---|---|---|
object.source_key | string | Retrieves a value from an object for transformation. | No |
object.target_key | string | Places a value into an object after transformation. | No |
Example
sub.transform.object.to.float(
settings={object: {source_key: 'a', target_key: 'z'}}
)
sub.tf.obj.to.float({obj: {src: 'a', trg: 'z'}})
object.to.integer
Converts a JSON value to an integer.
Settings
Field | Type | Description | Required |
---|---|---|---|
object.source_key | string | Retrieves a value from an object for transformation. | No |
object.target_key | string | Places a value into an object after transformation. | No |
Example
sub.transform.object.to.integer(
settings={object: {source_key: 'a', target_key: 'z'}}
)
sub.tf.obj.to.int({obj: {src: 'a', trg: 'z'}})
object.to.string
Converts a JSON value to a string.
Settings
Field | Type | Description | Required |
---|---|---|---|
object.source_key | string | Retrieves a value from an object for transformation. | No |
object.target_key | string | Places a value into an object after transformation. | No |
Example
sub.transform.object.to.string(
settings={object: {source_key: 'a', target_key: 'z'}}
)
sub.tf.obj.to.str({obj: {src: 'a', trg: 'z'}})
object.to.unsigned_integer
Converts a JSON value to an unsigned integer.
Settings
Field | Type | Description | Required |
---|---|---|---|
object.source_key | string | Retrieves a value from an object for transformation. | No |
object.target_key | string | Places a value into an object after transformation. | No |
Example
sub.transform.object.to.unsigned_integer(
settings={object: {source_key: 'a', target_key: 'z'}}
)
sub.tf.obj.to.uint({obj: {src: 'a', trg: 'z'}})
Use Cases
Convert Data To an Object
Convert data into a JSON object by configuring the object.set_key
:
sub.transform.object.copy(
settings={object: {target_key: 'z'}}
)
abc
{"z":"abc"}
Convert Data From an Object
Convert a JSON value into data by configuring the object.key
:
sub.transform.object.copy(
settings={object: {source_key: 'z'}}
)
{"z":"abc"}
abc
Updated 10 months ago