Copy JSON value
Apache 2.0Copies a JSON value from one key to another. The existing key/value pair remains unaffected by this change. Attempts to create the new key if it does not exist.
org. openrewrite. json. CopyValueRequired
A JSONPath expression to locate a JSON value to copy.
A JSONPath expression to locate the parent JSON object, either the object itself or the key holding it. A trailing .* is ignored, so $.x.y.* is the same as $.x.y.
The key to create.
Optional
The file path to the JSON file to copy the value from. If null then the value will be copied from any JSON file it appears within.
The file path to the JSON file to copy the value to. If null then the value will be copied only into the same file it was found in.
mod run . --recipe= org. openrewrite. json. CopyValue \
-P sourceKeyPath= '$. source. kind' \
-P destinationKeyPath= ''\''$. subjects'\'' or '\''$'\'' or '\''$. x[1]. y'\'' etc. ' \
-P destinationKey= myKeyInstall it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.