key / value encoding w/ etcdctl --write-out json

723 views
Skip to first unread message

Jesse Millan

unread,
Oct 10, 2016, 5:44:23 PM10/10/16
to etcd-dev
Could someone explain what's happening in terms of the formatting / encoding of the key and values between the simple and json write-out options?

For example, in simple mode, I see foo3/bar3. If I specify JSON, I see Zm9vMw==/YmFyMw==

etcdctl get foo3
foo3
bar3


etcdctl --write-out json get foo3
{"header":{"cluster_id":831478053,"member_id":2,"revision":130},"kvs":[{"key":"Zm9vMw==","create_revision":107,"mod_revision":107,"version":1,"value":"YmFyMw=="}],"count":1}


Thanks!

-Jesse



Louis Taylor

unread,
Oct 10, 2016, 5:47:12 PM10/10/16
to etcd-dev, jlam...@gmail.com
It's the base64 encoded value.

Cheers,
Louis

Brandon Philips

unread,
Oct 10, 2016, 5:58:09 PM10/10/16
to Louis Taylor, etcd-dev, jlam...@gmail.com
And the reason it is base64 encoded is because etcd can hold onto binary data. While JSON cannot encode binary data. So, we base64 everything and put it into a string.

Cheers,

Brandon

--
You received this message because you are subscribed to the Google Groups "etcd-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to etcd-dev+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jesse Millan

unread,
Oct 10, 2016, 7:20:04 PM10/10/16
to etcd-dev, lo...@kragniz.eu, jlam...@gmail.com
Thanks Louis and Brandon.
Reply all
Reply to author
Forward
0 new messages