Description
I have a Python script that retrieves JSON documents from Google AppEngine and needs to upsert them into a Couchbase bucket. The documentation on 'upsert', found here:
https://developer.couchbase.com/documentation/server/current/sdk/python/start-using-sdk.html
provides an example of 'upsert' using Python objects, e.g.,
cb.upsert('u:king_arthur', {'name': 'Arthur', 'email': 'kingarthur@couchbase.com', 'interests': ['Holy Grail', 'African Swallows']})
The more detailed API documentation, found here:
http://pythonhosted.org/couchbase/api/couchbase.html
Also uses Python objects. But there is no example showing me what to do if I have a string of JSON. What I'd like to see is something like:
JSONstr = "{\"key1\": \"value1\", \"key2\": 123}"
JSONobj = json.loads(JSONstr)
cb.upsert("documentID",JSONobj)