# How to auto export JSON file after running SQL command?

**URL:** https://discuss.zetetic.net/t/how-to-auto-export-json-file-after-running-sql-command/2544
**Category:** Issues
**Created:** [December 21, 2017, 1:42pm UTC](https://discuss.zetetic.net/t/how-to-auto-export-json-file-after-running-sql-command/2544 "2017-12-21T13:42:14Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![Kangland](https://avatars.discourse-cdn.com/v4/letter/k/f4b2a3/32.png) [@Kangland](https://discuss.zetetic.net/u/Kangland)
#### Post date: [December 21, 2017, 1:42pm UTC](https://discuss.zetetic.net/t/how-to-auto-export-json-file-after-running-sql-command/2544/1 "2017-12-21T13:42:14Z")

</div>

Step:

1. open the db file
2. run sql command: SELECT `audioUrlStorage`,`name`,`pageUrlStorage`,`thumbnailUrl` FROM `Books` ;
3. **Use command** to export JSON with Selected table.

I don’t know use what command to export to JSON file with selected table, not orginal db file .

Please teach me !!

Thank you so much !

---

<div class="post-metadata">

### Author: ![developernotes](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.zetetic.net/developernotes/32/1309_2.png) [@developernotes](https://discuss.zetetic.net/u/developernotes)
#### Post date: [December 21, 2017, 2:34pm UTC](https://discuss.zetetic.net/t/how-to-auto-export-json-file-after-running-sql-command/2544/2 "2017-12-21T14:34:36Z")

</div>

Hi @Kangland

You might consider reviewing the JSON support that SQLite includes, their documentation is quite helpful and available [here](https://sqlite.org/json1.html).

---

<div class="post-metadata">

### Author: ![mmoore](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.zetetic.net/mmoore/32/858_2.png) [@mmoore](https://discuss.zetetic.net/u/mmoore)
#### Post date: [December 21, 2017, 3:35pm UTC](https://discuss.zetetic.net/t/how-to-auto-export-json-file-after-running-sql-command/2544/3 "2017-12-21T15:35:53Z")

</div>

@Kangland

In addition to the documentation the @developernotes linked, a GUI tool called [DB Browser for SQLite](http://sqlitebrowser.org) – which is compatible with SQLCipher databases – can be very handy for what you’re attempting to accomplish.

You might have a look at my response here: [Save query results as csv](https://discuss.zetetic.net/t/save-query-results-as-csv/2343/2) which shows an example of how to export a table as a CSV using DB Browser for SQLite. The steps for what you’d like to accomplish should be very similar, but once you go to export the table generated by the query, you’ll want to use File → Export → Table(s) as JSON

---

<div class="post-metadata">

### Author: ![Kangland](https://avatars.discourse-cdn.com/v4/letter/k/f4b2a3/32.png) [@Kangland](https://discuss.zetetic.net/u/Kangland)
#### Post date: [December 24, 2017, 1:01pm UTC](https://discuss.zetetic.net/t/how-to-auto-export-json-file-after-running-sql-command/2544/4 "2017-12-24T13:01:04Z")

</div>

Thanks @developernotes @mmoore rely .

But It’s not helpful.

I use SQLiteStudio to do it

The SQLiteStudio is very directly than DB Browser for SQLite.

---

<div class="post-metadata">

### Author: ![developernotes](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.zetetic.net/developernotes/32/1309_2.png) [@developernotes](https://discuss.zetetic.net/u/developernotes)
#### Post date: [December 26, 2017, 2:04pm UTC](https://discuss.zetetic.net/t/how-to-auto-export-json-file-after-running-sql-command/2544/5 "2017-12-26T14:04:05Z")

</div>

Hi @Kangland

> [@Kangland](#):
>
> But It’s not helpful.
> 
> I use SQLiteStudio to do it

I am not familar with SQLiteStudio, however it is unclear what problem you are facing. Please share the details of the issue here. Are you having a problem with SQLCipher specifically? If not, you might consider reaching out to the SQLiteStudio support [here](https://sqlitestudio.pl/index.rvt?act=contact).

---

<div class="post-metadata">

### Author: ![Kangland](https://avatars.discourse-cdn.com/v4/letter/k/f4b2a3/32.png) [@Kangland](https://discuss.zetetic.net/u/Kangland)
#### Post date: [December 27, 2017, 4:34am UTC](https://discuss.zetetic.net/t/how-to-auto-export-json-file-after-running-sql-command/2544/6 "2017-12-27T04:34:52Z")

</div>

My issues is "How to export JSON file with selected table.

There’s no this function in DB browser for sqlite.

but It has in SQLiteStudio.

If you don’t know, you can check out SQLiteStudio.

![2017-12-27_123331](https://us1.discourse-cdn.com/flex016/uploads/zetetic/original/1X/82cca9bcc5aaa878e9bc118f1b09850d031b8a75.png)

---

<div class="post-metadata">

### Author: ![Kangland](https://avatars.discourse-cdn.com/v4/letter/k/f4b2a3/32.png) [@Kangland](https://discuss.zetetic.net/u/Kangland)
#### Post date: [December 27, 2017, 4:35am UTC](https://discuss.zetetic.net/t/how-to-auto-export-json-file-after-running-sql-command/2544/7 "2017-12-27T04:35:36Z")

</div>

![2017-12-27_123354](https://us1.discourse-cdn.com/flex016/uploads/zetetic/original/1X/ad8079acbcaaa4ec7e9b3253a04a0e478057d904.png)

---

<div class="post-metadata">

### Author: ![mmoore](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.zetetic.net/mmoore/32/858_2.png) [@mmoore](https://discuss.zetetic.net/u/mmoore)
#### Post date: [December 27, 2017, 5:56pm UTC](https://discuss.zetetic.net/t/how-to-auto-export-json-file-after-running-sql-command/2544/8 "2017-12-27T17:56:42Z")

</div>

@Kangland

While there is no direct function to export from query to JSON within DB Browser for SQLite – you can have the query create a table, export the table to JSON, then drop the table so it doesn’t persist.

There’s an example in my previous response: [Save query results as csv](https://discuss.zetetic.net/t/save-query-results-as-csv/2343/2) for CSV. All you should have to adjust is to use Export → Table(s) as JSON

---

<div class="post-metadata">

### Author: ![Kangland](https://avatars.discourse-cdn.com/v4/letter/k/f4b2a3/32.png) [@Kangland](https://discuss.zetetic.net/u/Kangland)
#### Post date: [December 28, 2017, 4:03am UTC](https://discuss.zetetic.net/t/how-to-auto-export-json-file-after-running-sql-command/2544/9 "2017-12-28T04:03:37Z")

</div>

Thank you .

This is why I’m use SQLiteStudio, and give up DB Browser for SQLite.
