SQLite Forum

Indexing JSON array contents
Login
If you could use generated columns with table-valued functions, then you could create a `STORED` version of your `EXISTS` expression, but you can't, so...

Another approach might be to extend JSON1 with a `json_find()` function that returns an array index. Then you could have something like this:

```SQL
CREATE TABLE test (
  id INTEGER PRIMARY KEY NOT NULL, 
  name TEXT,
  array TEXT NOT NULL,
  has_a INT AS (json_find(array, 'a') > 0) STORED
);
```

...and then create the index on `test.has_a`.