Rename\transform a key\selector #240
-
Is it possible to rename\transform a key\selector? if so, how? E.g., having the following JSON { "foo": "spam" } How can { "bar": "spam" } |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
There isn't a specific rename feature but you could do something like this: $ echo '{"foo":"spam"}' > file.json
dasel put string -f file.json '.bar' $(dasel -f file.json --plain '.foo')
dasel delete -f file.json '.foo'
~ [] $ cat file.json
{
"bar": "spam"
} |
Beta Was this translation helpful? Give feedback.
-
I'd love to see some sort of feature along these lines as well. I ran into this today and was hoping to use dasel for it since I learned about it yesterday. I couldn't figure it out from the docs, and rather than
|
Beta Was this translation helpful? Give feedback.
There isn't a specific rename feature but you could do something like this: