Reverse key-value pairs

JSON pattern

This pattern reverses key-value pairs when the value is a string.


Apply with the Grit CLI
grit apply reverse_json_kv

Matches a key-value pair

BEFORE
{ "foo": 5, "bar": "buz" }
AFTER
{ "foo": 5, "buz": "bar" }