2

Given the below example, is there a way to change the value from "bar" to "blah" without decoding them?

redis 127.0.0.1:6379> eval 'return cjson.encode({["foo"]= "bar"})' 0
"{\"foo\":\"bar\"}"

redis 127.0.0.1:6379> eval 'return cjson.decode(ARGV[1])["foo"]' 0 "{\"foo\":\"bar\"}"
"bar"

Reference for example: https://redis.io/commands/eval

rohitmohta
  • 1,001
  • 13
  • 22

1 Answers1

10

Nope, you'll have to go through a full decoding and encoding cycle. That's exactly one of the "pains" that http://rejson.io tries to solve. See http://rejson.io/performance/#comparison-vs-server-side-lua-scripting for more info.

Disclaimer: author of ReJSON here.

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