Reputation: 57
I often have a JSON which contains sensitive values. I would like to delete all JSON values in one simple swoop, but keep the keys intact (for example for showing the structure of the json). Is there an easy way to do this with VIM? (plugins are also fine)
Here is an example to illustrate what I mean:
before
{
"project_id": "ljwnw1vaxe",
"private_key_id": "68656c6c6f7468657265",
"private_key": "-----BEGIN OPENSSH PRIVATE KEY-----...."
}
after
{
"project_id": "",
"private_key_id": "",
"private_key": ""
}
Upvotes: 1
Views: 304
Reputation: 1115
You could use a regex in combination with the search and replace functionality in vim:
:%s/: ".*"/: ""/g
Upvotes: 3