Thanks Jens, and massive apologies for the repost - I had a brain failure 
and didn't even see your original reply :(

We want the "raw" JSON because we already have a library of platform code 
that understands and deserialises our JSON. This platform code is currently 
on other OS's and is being ported to mobile. Couchbase Lite gives us 
everything we need to make our platform sync onto the mobile device as long 
as we can get at the raw JSON.

I would imagine that other users that already have code built that 
deserialises JSON into their own domain objects could benefit from access 
to the raw JSON.

But for now we have a workaround - we just javascript-encode the json when 
we insert into Couchbase so that it comes through into Lite as a property 
called "body". Not ideal, but it works for now.

Tim

On Wednesday, October 22, 2014 5:25:29 PM UTC+1, Jens Alfke wrote:
>
>
> On Oct 22, 2014, at 4:43 AM, Tim Clarke <[email protected] <javascript:>> 
> wrote:
>
> However, our Couchbase docs are all JSON and when we retrieve them from 
> Couchbase Lite they are returned as a dictionary of properties with the 
> JSON having been split into individual properties. This is clever, but not 
> quite what we want. We need the raw JSON string.
>
>
> (I have a weird feeling that I already answered this exact question a week 
> ago; are you reposting?)
>
> If you want the document in JSON form, use NSJSONSerialization to encode 
> the dictionary. (I'm not sure why you'd want that, though; are you just 
> going to send it to some other API to parse it again?)
>
> Is there any way to access the raw JSON document in Couchbase Lite?  (And 
> if not, could this be a new feature in a future release?)
>
>
> There's not really any such thing as the "raw" JSON. The JSON coming in 
> from the server gets parsed and transformed during document insertion, and 
> the version stored in the database file has had bits spliced out of it (all 
> the metadata properties) that then get reconstituted when it's loaded. I 
> have some future optimizations I've been prototyping in which the storage 
> format won't even be even JSON at all anymore but a binary format that's 
> more efficient to parse.
>
> —Jens
>

-- 
You received this message because you are subscribed to the Google Groups 
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/9dc4e665-91b6-4dc5-9db0-f60cda55f987%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to