0

i have data stored in redis in messagepack. How to view the data decoded in redis-cli.

I don't see any commands related to it.

Krishna Deepak
  • 1,735
  • 2
  • 20
  • 31
  • redis LUA has `http://redis.io/commands/EVAL` seach for `cmsgpack`. Also, http://fperrad.github.io/lua-MessagePack/msgpack.html#examples may be interesting. – Ryan Vincent Mar 24 '16 at 19:53

1 Answers1

2

redis-cli has no pretty-print functionality (yet). However, as @Ryan Vincent had suggested, you can use a Redis Lua script for that purpose. Assuming that your MessagePack-ed data is stored in the String key called foo, this would do your bidding:

EVAL "return cmsgpack.unpack(redis.call('GET', KEYS[1]))" 1 foo

EDIT: the above assumes that the data is serialized as arrays. Returning an object will not work as Redis' protocol doesn't support that.

Itamar Haber
  • 47,336
  • 7
  • 91
  • 117