Sub selection of JSON document via URI

7 views
Skip to first unread message

Marak Squires

unread,
Sep 6, 2009, 7:42:43 AM9/6/09
to CloudKit
Is it possible to query the JSON document inside a collection from the
URI?

For example, if I have a collection at: '/data'

And I have the following document: '/data/4b1953c1-7d03-012c-
a18b-4040f67bf8d1'

Which contains the JSON: '{"foo": "bar"}'

How could I perform a GET on a URI like: "/data/4b1953c1-7d03-012c-
a18b-4040f67bf8d1/foo" and return the value "bar"?

I'd like to be able to query/sub select the JSON so I don't have to
return the full document. I'm a bit confused as to how I can do more
robust selector statements server side. Is this the wrong approach?

Jon Crosby

unread,
Sep 7, 2009, 11:51:13 AM9/7/09
to clou...@googlegroups.com
We discussed this in IRC, but I am replying on the mailing list for everyone's benefit. Basically, JSONQuery will handle this on the server side once I merge those changes into the master branch. JSONQuery already provides this functionality on the client side via the jQuery plugin, jquery.cloudkit.js. The JSONQuery expression to extract the value of foo from the object {foo:"bar"} would be ".foo" or "/data/4b1953c1-7d03-012c-a18b-4040f67bf8d1/.foo".

-Jon
Reply all
Reply to author
Forward
0 new messages