json-transform
Apply deterministic transformation operations to JSON objects and arrays.
Why install it
Agents constantly need to reshape API responses and intermediate data. This tool gives you a stable transformation surface instead of bespoke glue code in every workflow.
Inputs
input: input JSON value to transformoperations: ordered list of transformation operations to apply
Outputs
result: final transformed JSON valueapplied_operations: operations that were applied successfullyvalidation_errors: collected validation or application errors
Supported operations
pick: keep only the specified top-level keys from an objectrename: rename one top-level key to another nameset: assign a value at a dot-path, creating nested objects as neededdelete: remove a value at a dot-path if it existsflatten: collapse a nested object into dot-path keyspluck: extract a single value from a dot-path into a new objectfilter_array: keep only array items whose field matches a given value
Local development
The source code for this tool can be found here
Test:
python -m unittest discover -s tests -p 'test_*.py'
Example invocation
python -u json_transform/__main__.py < input.json
With input.json containing:
{
"input": {
"user": {
"name": "Ada",
"role": "admin"
}
},
"operations": [
{
"op": "pluck",
"path": "user.name",
"as": "name"
}
]
}