1

I am a getting query result from couchdb emit function in python as follows:

<Row id=u'c0cc622ca2d877432a5ccd8cbc002432', key=u'eric', value={u'_rev': u'1-e327a4c2708d4015e6e89efada38348f', u'_id': u'c0cc622ca2d877432a5ccd8cbc002432', u'email': u'yap', u'name': u'eric'}>

How do I parse the content of value item as:

{u'_rev': u'1-e327a4c2708d4015e6e89efada38348f', u'_id': u'c0cc622ca2d877432a5ccd8cbc002432', u'email': u'yap', u'name': u'eric'}

using json?

2 Answers 2

1

I'm not sure what you mean by "parsing the contents using json". The data should already be parsed and you can refer to any attributes by doing something like row.value["_id"] where row is the name of the variable referencing the Row object.

Sign up to request clarification or add additional context in comments.

Comments

0

The value is already converted to a python dictionary. So, if you need to change it to a JSON string just use json.loads, otherwise you can access the key with row.key and value attributes with row.value['some_attribute'].

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.