How to auto export JSON file after running SQL command?

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 !

Hi @Kangland

You might consider reviewing the JSON support that SQLite includes, their documentation is quite helpful and available here.

@Kangland

In addition to the documentation the @developernotes linked, a GUI tool called DB Browser for SQLite – 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 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

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.

Hi @Kangland

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.

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

2017-12-27_123354

@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 for CSV. All you should have to adjust is to use Export → Table(s) as JSON

Thank you .

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