SQLite Forum

Insert ("slurp" ?) JSON documents
Login
It is unclear what you are trying to do. There is a [JSON1 extension](https://sqlite.org/json1.html) for dealing with JSON data in SQLite.

If simonw is correct, then while the sqlite-utils CLI tool may do it like mentioned, it is also possible to do using the JSON1 extension, as follows:

```sql
insert into dogs(id,name,age) select json_extract(value,'$.id'),json_extract(value,'$.name'),json_extract(value,'$.age') from json_each(readfile('dogs.json'));
```

(Although using sqlite-utils is probably more convenient.)

If you are just trying to put each raw JSON file into a separate row of the table, then you do not need to parse JSON at all; you can just use the `readfile` function (which is part of the standard SQLite command shell).

If you are trying to do something else, read the documentation for the JSON1 extension, and see if it explains it.