Change key

Apache 2.0

Change a JSON mapping entry key, while leaving the value intact.

org.openrewrite.json.ChangeKey

Required

A JsonPath expression to locate a JSON entry.

The new name for the key selected by oldKeyPath.

mod run . --recipe=org.openrewrite.json.ChangeKey \ -P oldKeyPath='$.subjects.kind' \ -P newKey=kind

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.