> On Mar 23, 2017, at 4:30 AM, Richard Hipp <d...@sqlite.org> wrote: > > BLOBs are reserved for a future enhancement in which BLOBs will store the > binary encoding for JSON.
I’ve been down this road. There are a number of JSON-compatible binary encoding formats, but most of them don’t save much time, because (a) they’re not _that_ much faster to parse, (b) reading JSON tends to be dominated by allocating an object tree, not by the actual parsing, and (c) usually you have to parse the entire data even if you only want to use one piece of it [as in a query]. I ended up designing and implementing a new format, called Fleece*. Its advantage is that it doesn’t require parsing or even memory allocation. The internal structure is already an object tree, except that it uses compressed relative offsets instead of pointers. This means that internal pointers into Fleece data can be used directly as the data objects. In my current project** we’re storing Fleece in SQLite instead of JSON, with a modified version of the json1 extension to make it accessible in queries. It works very well. The Fleece equivalent of json_extract( ) just does some pointer manipulation to find the root object in the blob, then further lookups to jump to each nested object in the path. —Jens * https://github.com/couchbaselabs/fleece <https://github.com/couchbaselabs/fleece> ** https://github.com/couchbase/couchbase-lite-core _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users