SQLite User Forum

Proposed JSON enhancements.
Login
SQLite should not assume that the left-hand operand of -> or - >> is a JSON string, instead the operand format should be recognized by type and subtype so that -> and - >> could work on a variety of formats.

Extensions should be able to register extraction functions for different formats identified by type and subtype so that the following examples would work:

```
        CREATE TABLE t1(
            id INTEGER PRIMARY KEY,
            json_str TEXT,
            bson_data BLOB
        );

        SELECT json(json_str)->'a', bson(bson_data)->'a' FROM t1;


        CREATE TABLE t2(
            id INTEGER PRIMARY KEY,
            type TEXT,
            data
        );

        CREATE VIEW v2 AS SELECT
            id,
            CASE type
                WHEN 'json' THEN json(data)
                WHEN 'bson' THEN bson(data)
                WHEN 'cbor' THEN cbor(data)
                WHEN 'hstore' THEN hstore(data)
            END AS object
        FROM t2;

        SELECT object->'a', object->>'b' FROM v2;
```