Riak Problem w/ Python Client "No JSON object could be decoded"

TJ Ninneman tj at twopeasinabucket.com
Thu Aug 25 12:42:14 EDT 2011

> Well i don't really care if it opens in a browser properly or not. The python
> Riak client is returning this error so something is wrong. When I run it in
> the command line it returns a json object but im still getting that error.

I would play around with this using the python interpreter.  Instead of calling my_bucket.get(key), I would use my_bucket.get_binary(key).  This will give you the raw string stored in Riak instead of auto-decoding it.  Inspect the result; make sure it does indeed look like valid json.  If it does, I'd run it through the stdlib json.loads and see what happens.

> Where do you set the application type header, are you talking about the
> bucket object, the object itself or is it something that is set on the riak
> server itself?

It's an attribute of the object itself.  It's set by default to "application/json" as long as you are creating standard Riak objects and not Riak binaries.  See http://basho.github.com/riak-python-client/tutorial.html#storing-keys-values for more detail.


More information about the riak-users mailing list