how to retrieve complete document body from couchbase lite for deserialisation into object

24 views
Skip to first unread message

Tim Clarke

unread,
Oct 17, 2014, 7:21:22 AM10/17/14
to mobile-c...@googlegroups.com
We have JSON documents in a couchbase bucket. This is shadowed into sync_gateway bucket which is then pulled down into Couchbase lite using a pull replication. This all works nicely.

Imagine my couchbase document looks like this
   
{
   
"colour": "green",
   
"count": "135"
}


When I retrieve the doc using Couchbase Lite then it has a properties dictionary with two entries, "colour" and "count". 

That's great, but how do I access the document body as a JSON string that I can deserialise into an object?

thanks!

Jens Alfke

unread,
Oct 17, 2014, 11:13:18 AM10/17/14
to mobile-c...@googlegroups.com

On Oct 17, 2014, at 4:21 AM, Tim Clarke <clark...@gmail.com> wrote:

When I retrieve the doc using Couchbase Lite then it has a properties dictionary with two entries, "colour" and "count". 
That's great, but how do I access the document body as a JSON string that I can deserialise into an object?

Um, I guess you can use NSJSONSerialization to encode the NSDictionary to JSON data. Which you can then deserialize again. But that seems kind of pointless. Maybe I'm misunderstanding the question?

—Jens
Reply all
Reply to author
Forward
0 new messages